jQuery.get() | jQuery get
Description:LoaddatafromtheserverusingaHTTPGETrequest.ThisisashorthandAjaxfunction,whichisequivalentto:Thesuccesscallbackfunctionispassedthereturneddata,whichwillbeanXMLrootelement,textstring,JavaScriptfile,orJSONobject,dependingontheMIMEtypeoftheresponse.Itisalsopassedthetextstatusoftheresponse.AsofjQuery1.5,thesuccesscallbackfunctionisalsopasseda"jqXHR"object[1](injQuery1.4,itwaspassedtheXMLHttpRequestobject).However,sinceJSONPandcross-domainGETrequestsdonotuseXHR,inthosecasesthejqXHRandte...
Description: Load data from the server using a HTTP GET request.
This is a shorthand Ajax function, which is equivalent to:
The success callback function is passed the returned data, which will be an XML root element, text string, JavaScript file, or JSON object, depending on the MIME type of the response. It is also passed the text status of the response.
As of jQuery 1.5, the success callback function is also passed a "jqXHR" object[1] (in jQuery 1.4, it was passed the XMLHttpRequest object). However, since JSONP and cross-domain GET requests do not use XHR, in those cases the jqXHR and textStatus parameters passed to the success callback are undefined.
Most implementations will specify a success handler:
1
2
3
4
$.get( "ajax/test.html", function( data ) {
$( ".result" ).html( data );
alert( "Load wa...