Mark van Driel 8 years ago
parent
commit
6c6b441642
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      examples/client.html

+ 6
- 5
examples/client.html View File

4
 <script>
4
 <script>
5
 var xhttp = new XMLHttpRequest();
5
 var xhttp = new XMLHttpRequest();
6
 xhttp.onreadystatechange = function() {
6
 xhttp.onreadystatechange = function() {
7
-  if (this.readyState == 4 && this.status == 200) {
8
-    console.log(this.responseText);
9
-    jsonObject = php_crud_api_transform(JSON.parse(this.responseText));
10
-    document.getElementById('output').innerHTML = JSON.stringify(jsonObject, undefined, 4);
11
-  }
7
+	if (this.readyState == 4 && this.status == 200) {
8
+		console.log(this.responseText);
9
+		jsonObject = php_crud_api_transform(JSON.parse(this.responseText));
10
+		document.getElementById('output').innerHTML = JSON.stringify(jsonObject, undefined, 4);
11
+	}
12
 };
12
 };
13
 xhttp.open("GET", "http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1", true);
13
 xhttp.open("GET", "http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1", true);
14
 xhttp.send();
14
 xhttp.send();
18
 <pre id="output"></pre>
18
 <pre id="output"></pre>
19
 </body>
19
 </body>
20
 </html>
20
 </html>
21
+

Loading…
Cancel
Save