javascript - Why is jQuery.getJSON structured the way it is? -


why getjson function structured way?

 $.getjson( url [, data ] [, success ] ) 

instead of returning object, i.e.:

 var myjson = $.getjson( url [, data ]) 

because returns jqxhr object contains responsetext , responsexml properties, getresponseheader() method. when transport mechanism other xmlhttprequest (for example, script tag jsonp request) jqxhr object simulates native xhr functionality possible. basically, how know if request successful?


Comments