jQuery Ajax post Method

jQuery Ajax post method loads data from server using the HTTP POST Request.

jQuery Ajax $.post() Method Syntax


url(Required): Url of the file you want to load.
function : (optional): Callback is executed when the request completes.

jQuery Ajax post method Example

<script type="text/javascript">
              $( "#ajaxExample" ).on( "click", function(event) {             
                          var uri = 'http://runtest.tutorialsplane.com/php/';
                          var firstName = $("#fname").val();
                          var lastName = $("#lname").val();
                              alert("Status = "+status+" Response = "+response);

Try it »

Output :

jQuery Ajax post Method

jQuery Ajax post Example

note : post_method_demo.php contains the following code

Post Method Demo

You Posted :

echo "first name = ".$_POST['firstName']."";
echo "  last name = ".$_POST['lastName']."";


Add Comment