jquery ajax() method

the jquery $.ajax() method is used to perform an asynchronous http(ajax) request.

the jquery.ajax() function relies on the server to provide information about the retrieved data.

note :- default settings can be set globally by using the $.ajaxsetup() method.

the jquery ajax method syntax  :-

.ajax ({ name:value,  name:value, name:value } )

possible names/values pairs show in the table.

parameterdescription
asyncdefault is true.boolean value indicate all request should be sent asynchronously or not.
beforesend(jqxhr)a callback function be run before the request is sent.
cachedefault is true.boolean value indicate whether the browser should cache the requested page.
complete(jqxhr,status)a function to be call when the request is finished(after success and error method).
contenttypedefault is 'application/x-www-form-urlencoded', 'charset-utf-8'.content type used when sending data to the server.
contextspecifies 'this' keyword value for all ajax callback functions.
convertersan object containing data type-of-datatype converters.
datadata to be sent to the server.
datafilter(data,tpe)a function to be used to handle the raw response data of xmlhttprequest.
datatypethe type of data that expecting back from the server.
error(jqxhr, status, error)a function to be run when the request fails.
globaldefault is true.whether to trigger global ajax event handlers for this request.
headersspecifying an object of header key/value pairs to send along with request.
ifmodifieddefault is false.boolean value indicating the request to be successful only if the response has changed the last request.
islocalboolean vaule allow the current environment to be recognized as 'local'.
jsonpthe override callback function name in a jsonp request.
jsonpcallbackspecifies the callback function name for a jsonp request.
mimetypea mime type to override the xhr mime type.
passwordspecify a password to be used in response to an http access authentication request.
processdatadefault is true.a boolean value specify whether or not data sent with the request should be transformed into query string.
scriptcharsetspecifies the charset for the request.
success(data,textstatus,jqxhr)specifies a function to be run when the request succeeds.
timeouta timeout(in milliseconds) for the request.
traditionalboolean value specify whether or not use traditional style of param serialization.
typedefault is get.the type of request to make ('post' or get).
urlthe url to send the request to.
usenamespecifies a username to be used in response to an http access authentication request.
xhra callback function for creating the xmlhttprequest object.
xhrfieldsan object of fieldname/value pairs to set on the native xhr object.

example