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)?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
You can access the
responseText
from 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
responseText
property on the promise.Here's the jQuery docs on the jqXHR object which is the promise object you get.
Additionally
$.when
and.then
are described in the Deferred object documentationWhy don't you just use the network tab in Chrome developer tools? That's the easiest way of viewing your raw requests and responses. Plus it is laid out in an easy to view format, showing cookies, timing values etc...