Reputation: 21
I must be really missing something but I can't find a way to retrieve the json payload from a post request using ember data. For example:
var onSuccess = function(data) {
//Want to get json payload from data
};
var onFail = function(data) {
//Want to get json payload from data
};
// save model which sends a post request to the server
model.save().then(onSuccess, onFail);
Any help much appreciated!
Upvotes: 1
Views: 731
Reputation: 6947
Ember Data automatically processes the response from a POST and inserts and/or replaces any objects with matching IDs. Objects are extracted from the payload automatically and placed in the store. Read about Ember Data's REST adapter and the conventions expected of your server
Upvotes: 1