How do I get the raw response returned by the server when using POST/DELETE methods in Backbone (so you can’t get the raw response in fetch/parse like GET)?
How do I get the raw response returned by the server when using POST/DELETE
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can access the
responseTextfrom the server when the ajax call is complete.The
save,fetch, etc methods from Backbone provide the jQuery promise generated by the call to$.ajax.When this promise has been resolved (e.g. the transaction is complete), you’ll have access to the
responseTextproperty on the promise.Here’s the jQuery docs on the jqXHR object which is the promise object you get.
Additionally
$.whenand.thenare described in the Deferred object documentation