todo_api/examples/client.html
Mark van Driel 6c6b441642 Cs fixes
2017-02-12 20:56:45 +01:00

21 lines
592 B
HTML

<html>
<head>
<script src="../lib/php_crud_api_transform.js"></script>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
jsonObject = php_crud_api_transform(JSON.parse(this.responseText));
document.getElementById('output').innerHTML = JSON.stringify(jsonObject, undefined, 4);
}
};
xhttp.open("GET", "http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1", true);
xhttp.send();
</script>
</head>
<body>
<pre id="output"></pre>
</body>
</html>