Significance / Usefulness / purpose of new jQuery.ajax way which returns the jqXHR object -


as of 1.5/1.51 version of jquery can make ajax request this

var jqxhr = $.ajax({ url: "example.php" })     .success(function() { alert("success"); })     .error(function() { alert("error"); })     .complete(function() { alert("complete"); });  // set completion function request above jqxhr.complete(function(){ alert("second complete"); }); 

1> still looking example/ demos / info know significant purpose way of doing jquery.ajax serves previous way not serving

2> how useful jqxhr object.

3> iam looking practical usefulness

well, jquery say:

the $.ajax() function returns xmlhttprequest object creates. jquery handles creation of object internally, custom function manufacturing 1 can specified using xhr option. returned object can discarded, provide lower-level interface observing , manipulating request. in particular, calling .abort() on object halt request before completes.

so if reason need create own xmlhttprequest object , send in $.ajax, provides way object after request.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -