jQuery global success work for any ajax frameworks calls?
Just wondering if the global ajax success within jQuery, get executed even if I call XMLHttpRequest man开发者_高级运维ually or from within another client side framework?
Like I'm wondering if jQuery proxies the XMLHttpRequest object so that it can tap into any XMLHttpRequest call...
No, jQuery does not hijack the browser's default implementation of XMLHttpRequest
. That's not the jQuery style of doing things. jQuery's philosophy is to leave the native objects untouched,* augment functionality using, amongst others, the Decorator pattern.
By nature XMLHttpRequest
must be implemented in native code, not JavaScript, so it wouldn't be easy to hijack - and there really wouldn't be any benefit, as far as the jQuery designers might be interested.
*as compared to, say, Prototype, which modifies many DOM prototypes to achieve similar end results to jQuery.
精彩评论