Post data to server using Jquery

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.post("api.php",
{
name: "Saurabh",
city: "Gurgaon"
},
function(data,status){
console.log(status);
console.log(data);
});
});
});
</script>
</head>
<body><button>Send an HTTP POST request to a page and get the result back</button>

</body>
</html>

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *