ajaxSettings
is a private jQuery class used to handle all the details of an Ajax connection. It is as follows:
ajaxSettings: { url: location.href, global: true, type: "GET", contentType: "application/x-www-form-urlencoded", processData: true, async: true, /* timeout: 0, data: null, username: null, password: null, traditional: false, */ // Create the request object; Microsoft failed to properly // implement the XMLHttpRequest in IE7 (can't request local files), // so we use the ActiveXObject when it is available // This function can be overriden by calling jQuery.ajaxSetup xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ? function() { return new window.XMLHttpRequest(); } : function() { try { return new window.ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} }, accepts: { xml: "application/xml, text/xml", html: "text/html", script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*" } }
The most important settings are:
url
– This property stores the URL used to fetch an Ajax resource. It defaults to the current URI of a web document.type
– This property stores the HTTP method used to fetch an Ajax resource. It defaults to GET.contentType
– This property sets the default content type send with a POST request.async
– This property defines if an Ajax request should be made asynchronously or not. It defaults totrue
xhr
– This method actually creates the XMLHttpRequest object.accepts
– This object literal stores a list of the content types accepted by jQuery.