ajax e dom
This commit is contained in:
34
ajax.html
Normal file
34
ajax.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p> Ciao, Simone è gay?</p>
|
||||
<p id="answer"></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
req= new XMLHttpRequest();
|
||||
req.addEventListener("load",handler,false);
|
||||
req.open("GET","ajax.php",true);
|
||||
req.send();
|
||||
|
||||
function handler(e){
|
||||
document.getElementById("answer").innerHTML = req.responseText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user