first commit
This commit is contained in:
25
test.html
Normal file
25
test.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Get data as JSON from a PHP file on the server.</h2>
|
||||
|
||||
<p id="demo"></p>
|
||||
|
||||
<script>
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
myObj = JSON.parse(this.responseText);
|
||||
document.getElementById("demo").innerHTML = myObj.name;
|
||||
}
|
||||
};
|
||||
xmlhttp.open("GET", "demo_file.php", true);
|
||||
xmlhttp.send();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user