jQuery post() method
The post() method is one of the commonly used HTTP methods. It is used to load a page from the server using an HTTP POST request. This method never caches the data and is generally used to send the data with the request. We cannot bookmark the POST requests.
This method includes four parameter values in which one is mandatory, and others are optional. We must have to include the URL parameter to the post() method. The parameter values of the post() method are defined in the following table.
Now, let's see a simple example of using the post() method.
In this example, we are making a post request by using the post() method. We are using the two parameters that are URL and callback function of the post() method. Here, the Http Post request is used to load data from the server.
The URL parameter is set to the value test.html. The callback function has two parameters data and status in which the first parameter holds the data of the requested page, and the second parameter holds the request status.
In the output, we can see the data load from the server, and the status of the request is success.
Example2.htmlTest it Now
After the execution of the above code, the output will be -
After clicking the given button, the output will be -