What is meant by AJAX?
- AJAX stands for Asynchronous JavaScript And XML. It enables web applications to retrieve data from the server asynchronously. A web application using AJAX is capable of partial page updates.
- AJAX is "the method of exchanging data with a server, and updating parts of a web page - without reloading the entire page".
- AJAX is not a programming language but a technique for creating fast and dynamic webpages.
AJAX syntax
$.ajax({name:value, name:value, ... })
AJAX Method Parameters
| Name | Description |
| type | It is used to specify the type of request (GET/POST). |
| url | It is used to specify the URL to send the request to. Default is the current page. |
| username | It is used to specify a username to be used in an HTTP access authentication request. |
xhr |
It is used for creating the XMLHttpRequest object. |
| async | Its default value is true. A Boolean value indicating whether the request should be handled asynchronously or not. |
| beforeSend(xhr) | It is a function which is to be run before the request is being sent. |
| dataType | The data type expected of the server response. |
| error(xhr, status, error) | It is used to run if the request fails. |
| global | Its default value is true. It is used to specify whether or not to trigger global AJAX event handles for the request. |
| ifModified | Its default value is false. It is used to specify whether a request is only successful if the response has changed since the last request. |
| jsonp | A string overriding the callback function in a jsonp request. |
| jsonpCallback | It is used to specify a name for the callback function in a jsonp request. |
| cache | Its default value is true. It indicates whether the browser should cache the requested pages. |
| complete(xhr, status) | It is a function which is to be run when the request is being finished. |
| contentType | Its default value is: “application/x-www-form-urlencoded” and it is used when data send to the server. |
| context | It is used to specify the “this” value for all AJAX related callback functions. |
| data | It is used to specify data to be sent to the server. |
| dataFilter(data, type) | It is used to handle the raw response data of the XMLHttpRequest. |
| password | It is used to specify a password to be used in an HTTP access authentication request. |
| processData | Its default value is true. It is used to specify whether or not data sent with the request should be transformed into a query string. |
| scriptCharset | It is used to specify the charset for the request. |
| success(result, status, xhr) | It is to be run when the request succeeds. |
| timeout | It is the local timeout for the request. It measured in terms of milliseconds. |
| traditional | It is used to specify whether or not to use the traditional style of param serialization. |


Join the conversation! Your thoughts help the community grow.