I have the following common code to invoke AJAX requests. My question is if the "return" keyword is necessary for the $.ajax (since doing $.ajax would anyways return a promise) OR if it is for some other purpose ?
doXhr: function(postData, requestUrl){
var promise = new Ember.RSVP.Promise(function(resolve, reject) {
return $.ajax({ //Is the "return" required on this line ?
url: requestUrl,
})
.done(function(response, status, xhrObject) {
resolve(response);
})
.fail(function(xhrObject, status, error){
reject(errorObj);
});
})
return promise;
},
Aucun commentaire:
Enregistrer un commentaire