This example, using no options, loads the contents of the current page, but does nothing with the result.
This allows you to assign multiple callbacks on a single request, and even to assign callbacks after the request may have completed.
(If the request is already complete, the callback is fired immediately.) Available Promise methods of the jq XHR object include: call are subjected to different kinds of pre-processing before being passed to the success handler.
The type of pre-processing depends by default upon the Content-Type of the response, but can be set explicitly using the can be used to specify, respectively, the name of the query string parameter and the name of the JSONP callback function.
The server should return valid Java Script that passes the JSON response into the callback function. For more information on JSONP, see the original post detailing its use.
By default, Ajax requests are sent using the GET HTTP method.
If the POST method is required, the method can be specified by setting a value for the options.
Ajax requests are time-limited, so errors can be caught and handled to provide a better user experience.
Request timeouts are usually either left at their default or set as a global default using ).
This is useful if the script and host page have differing character sets.
The first letter in Ajax stands for "asynchronous," meaning that the operation occurs in parallel and the order of completion is not guaranteed.
The on the object will halt the request before it completes.