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
Post a Comment