AJAX is a technique, not a programming language that is used by developers to make websites behave like desktop applications. It operates on the client-side for creating asynchronous web applications. AJAX is a group of technologies that uses a number of web technologies for creating a set of web development techniques.
jQuery provides various methods for AJAX functionality. There are some jQuery AJAX methods that are used to request text, HTML, XML, or JSON from a remote server using both HTTP Get and HTTP Post.
Syntax:
$.ajax_method(parameter1, parameter2, ..)
Example: This example use param() method to create serialized representation of an object.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
jQuery param() Method
</ title >
</ script >
</ head >
< body style = "text-align:center;" >
< h1 style = "color:green;" >
GeeksForGeeks
</ h1 >
< h2 >jQuery param() Method</ h2 >
< button >Click</ button >
< div ></ div >
< script >
$(document).ready(function() {
personObj = new Object();
personObj.Firstword = "Geeks";
personObj.Secondword = "For";
personObj.Thirdword = "Geeks";
personObj.Wordcolor = "Green";
$("button").click(function() {
$("div").text($.param(personObj));
});
});
</ script >
</ body >
</ html >
|
Output:
jQuery AJAX Method Complete Reference:
Methods | Description |
---|
ajax() | Perform an AJAX request or asynchronous HTTP request. |
ajaxSetup() | Set the default values for future AJAX requests. |
get() | Loads data from the server by using the GET HTTP request. |
getJSON() | Fetches JSON-encoded data from the server using a GET HTTP request. |
parseJSON() | Takes a well-formed JSON string and returns the resulting JavaScript value. |
getScript() | Run a JavaScript using AJAX HTTP GET request. |
param() | Create a serialized representation of an object. |
post() | Returns an XMLHttpRequest object. |
ajaxComplete() | Specify a function to be run when an AJAX request completes. |
ajaxError() | Specify a function to be run when an AJAX request fails. |
ajaxSend() | Specify the function to be run when an AJAX request is about to send. |
ajaxStart() | Specify a function to be run when an AJAX request starts. |
ajaxStop() | Specify a function to be run when AJAX requests have been completed. |
ajaxSuccess() | Specify the function to be run when an AJAX request is completed successfully. |
load() | It is a simple but very powerful AJAX method. |
serialize() | Create a text string in standard URL-encoded notation. |
serializeArray() | Create a JavaScript array of objects that is ready to be encoded as a JSON string. |