post data from api using jquery ajax 1

post data from api using jquery ajax

$.ajax({
   url: 'ajaxfile.php',
   type: 'post',
   data: {name:'yogesh',salary: 35000,email: 'yogesh@makitweb.com'},
   success: function(response){

   }
});

Here is what the above code is Doing:
1. We are sending an AJAX request to ajaxfile.php file.
2. We are sending three data to the file.
3. If the request is successful, we will get the response from the file.

Now, let’s create ajaxfile.php file and add the following code to it.

“;
echo “Salary: “.$salary.”
“;
echo “Email: “.$email.”
“;

?>

Similar Posts