Last active
August 29, 2015 14:22
-
-
Save lstrihic/86e80714b1b30b794fba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<script> | |
function grabJSON(){ | |
var xmlhttp=new XMLHttpRequest(); | |
xmlhttp.onreadystatechange=function() { | |
if (xmlhttp.readyState==4 && xmlhttp.status==200) { | |
var employees = JSON.parse(xmlhttp.responseText); | |
alert(employees.name); | |
} | |
} | |
xmlhttp.open("GET","json.php",true); | |
xmlhttp.send(); | |
} | |
</script> | |
</head> | |
<body onload="grabJSON();"> | |
<div id="tekst"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-Type: application/json"); | |
echo "{\"name\":\"ben\",\"age\":23,\"skills\":[\"php\",\"css\",\"javascript\"]}"; | |
exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment