AJAX allows web pages to be updated "asynchronously" by exchanging data with a web server behind the scenes.
This means that it is possible to update parts of a web page, without reloading the whole page.
The jQuery library has a full suite of Ajax capabilities.
The functions and methods therein allow us to load data from the server without a browser page refresh.
These methods attaches a function to be called when certain Ajax events, such as initialization or completion, take place for any Ajax request on the page:
|ajaxComplete()||Attach a function to be called when Ajax requests complete. This is an AjaxEvent|
|ajaxError()||Attach a function to be called when Ajax requests complete with an error. This is an Ajax Event|
|ajaxSend()||Attach a function to be called before an Ajax request is sent. This is an Ajax Event|
|ajaxStart()||Attach a function to be called when the first Ajax request begins. This is an Ajax Event|
|ajaxStop()||Attach a function to be called when all Ajax requests have completed. This is an Ajax Event|
|ajaxSuccess()||Attach a function to be called whenever an Ajax request completes successfully. This is an Ajax Event|
These functions assist with common idioms encountered when performing Ajax tasks:
|$.param()||Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests)|
|serialize()||Encodes a set of form elements as a string for submission|
|serializeArray()||Encodes a set of form elements as an array of names and values|
These methods can be used to make arbitrary Ajax requests:
|$.ajax()||Performs an async HTTP (AJAX) request|
|$.ajaxPrefilter()||Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax()|
|$.ajaxSetup()||Sets the default values for future AJAX requests. Its use is not recommended|
|$.ajaxTransport()||Creates an object that handles the actual transmission of Ajax data|
These methods perform the more common types of Ajax requests in less code:
|$.get()||Loads data from a server using a HTTP GET request|
|$.getJSON()||Loads JSON-encoded data from a server using a GET HTTP request|
|$.post()||Loads data from a server using a HTTP POST request|
|load()||Load data from the server and place the returned HTML into the selected elements|