What is the use of jQuery.ajax method?

Solution

ajax() method of jQuery is used to perform asynchronous HTTP request.

The syntax of ajax() method is

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

Example:

$.ajax({
 
    // The URL for the request
    url: "/example",
 
    // The data to send (will be converted to a query string)
    data: {
        id: 123
    },
 
    // Whether this is a POST or GET request
    type: "GET",
 
    // The type of data we expect back
    dataType : "json",
})

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media