javascript - How can I monitor Backbone ajax requests? -


i thought easy b.c. backbone uses jquery , has single access point thought this:

  backbone.ajax = function() {     var xhr = backbone.$.ajax.apply(backbone.$, arguments);      // xhr.addeventlistener("loadend", loadend);     return xhr;   }; 

but reason can not load event listener xhr object do.

i error stating addeventlistener not function.

see jqxhr:

the jquery xmlhttprequest (jqxhr) object returned $.ajax() of jquery 1.5 superset of browser's native xmlhttprequest object.

it not native xmlhttprequest, might not behave native one. there no guarantee exposes methods addeventlistener unless it's documented. if want set globally it's safer use jquery.ajaxsetup


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -