jQuery | post() Method Last Updated : 01 Mar, 2019 Suggest changes Share Like Article Like Report The post() method in jQuery loads the page from server using POST HTTP request and returns XMLHttpRequest object. Syntax: $.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. php <?php echo "Hello Geeks!"; ?> Example: This example use post() method and call a PHP file. html <!DOCTYPE html> <html> <head> <title> jQuery post() Method </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> </head> <body> <h2 id="gfg">GeeksforGeeks</h2> <button id="b"> Click Here! </button> <!-- Script to use post() method --> <script> $(document).ready(function() { $("button").click(function() { $.post("/submit.php", { name: "GFG", }, function(data,status) { document.getElementById("gfg").innerHTML = data; document.getElementById("b").innerHTML = "Data Passed"; }); }); }); </script> </body> </html> Output: Before clicking on the button: After clicking on the button: X XDoodler Follow Explore jQuery Tutorial 8 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read Article Tags : Web Technologies JQuery jQuery-AJAX Like