Browse Source

improved examples

Maurits van der Schee 9 years ago
parent
commit
3bc3de224b
3 changed files with 4 additions and 3 deletions
  1. 1
    1
      client.html
  2. 1
    1
      client.php
  3. 2
    1
      client_ng.html

+ 1
- 1
client.html View File

@@ -7,7 +7,7 @@ function callback(jsonObject) {
7 7
   document.getElementById('output').innerHTML = JSON.stringify(jsonObject, undefined, 4);
8 8
 }
9 9
 </script>
10
-<script src="http://localhost/blog.php/posts,categories,tags,comments?filter=id,eq,1&callback=callback" defer="defer"></script>
10
+<script src="http://localhost/api.php/posts,categories,tags,comments?filter=id,eq,1&callback=callback" defer="defer"></script>
11 11
 </head>
12 12
 <body>
13 13
 <pre id="output"></pre>

+ 1
- 1
client.php View File

@@ -16,7 +16,7 @@ function call($method, $url, $data = false) {
16 16
 	return curl_exec($ch);
17 17
 }
18 18
 
19
-$response = call('GET','http://localhost/blog.php/posts,categories,tags,comments?filter=id,eq,1');
19
+$response = call('GET','http://localhost/api.php/posts,categories,tags,comments?filter=id,eq,1');
20 20
 $jsonObject = json_decode($response,true);
21 21
 
22 22
 $jsonObject = php_crud_api_transform($jsonObject);

+ 2
- 1
client_ng.html View File

@@ -5,7 +5,8 @@
5 5
 <script>
6 6
 var app = angular.module('myApplication', []);
7 7
 app.controller('postController', function($scope, $http) {
8
-    $http.get("http://localhost/blog.php/posts,categories,tags,comments")
8
+    $http.post("http://localhost/api.php/posts",{user_id:1,category_id:1,content:"from angular"});
9
+    $http.get("http://localhost/api.php/posts,categories,tags,comments")
9 10
     .success(function(response) { $scope.posts = php_crud_api_transform(response).posts; });
10 11
 });
11 12
 </script>

Loading…
Cancel
Save