Merge pull request #122 from eddyystop/master
Possible correction to web services sample code
This commit is contained in:
commit
036111e6e8
1 changed files with 6 additions and 1 deletions
|
|
@ -138,11 +138,16 @@ In the example below, we take advantage of queuing to debug the AJAX response da
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var users = m.request({method: "GET", url: "/user"})
|
var users = m.request({method: "GET", url: "/user"})
|
||||||
.then(console.log);
|
.then(log);
|
||||||
.then(function(users) {
|
.then(function(users) {
|
||||||
//add one more user to the response
|
//add one more user to the response
|
||||||
return users.concat({name: "Jane"})
|
return users.concat({name: "Jane"})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function log(load) {
|
||||||
|
console.log(load)
|
||||||
|
return load
|
||||||
|
}
|
||||||
|
|
||||||
//assuming the response contains the following data: `[{name: "John"}, {name: "Mary"}]`
|
//assuming the response contains the following data: `[{name: "John"}, {name: "Mary"}]`
|
||||||
//then when resolved (e.g. in a view), the `users` getter-setter will contain a list of users
|
//then when resolved (e.g. in a view), the `users` getter-setter will contain a list of users
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue