The post() method in jQuery loads the page from server using POST HTTP request and returns XMLHttpRequest object.
$.post( url, data, callback_function, data_type )
Parameters: This method accepts four parameters as mentioned above and described below:
- url: It is the required parameter and used to send the request.
- data: It is optional parameter and it represents key/value pairs of data that will be sent to the server.
- callback_function: It is optional parameter and it represents a function to be executed when the data is loaded successfully.
- data_type: It is optional parameter and it represents a type of data to be returned to callback function: xml, html, script, json, jsonp, or text.
main.php This PHP file call in the below example when button pressed.
Example: This example use post() method and call a PHP file.
Before clicking on the button:
After clicking on the button:
- Get and Post method using Fetch API
- How to get form data using POST method in PHP ?
- Simple GET and POST request using Fetch API method by making custom HTTP library
- HTTP GET and POST Methods in PHP
- How to receive JSON POST with PHP
- Two most misunderstood terms GET and POST in web development
- How to select and upload multiple files with HTML and PHP, using HTTP POST?
- How to display bootstrap carousel with three post in each slide?
- Perl | GET vs POST in CGI
- Tracxn Experienced Interview (3yrs SSE post)
- Associate user to its upload (post) in Django
- Post/Redirect/Get (PRG) Design Pattern
- Simple POST request using the fetch API
- What is POST(Power-On-Self-Test)?
- How to post data using file_get_contents in PHP ?
- Express.js | app.post() Function
- POST request using AJAX by making Custom HTTP library
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.