Jquery ajax request example

By Hardik Savani | April 10, 2016 | Category : Javascript jQuery JSON Ajax

If you are very fresher in jquery and you don't know how to work post ajax request then bellow example can help you. i gave you the example of POST ajax request with json, you can also easily modify this example. you also fire GET ajax request using this example. bellow example is a pretty simple to undestand how to work $.ajax method. so let's see bellow example and try to undestand.


<html lang="en">


<title>JQuery Ajax Demo</title>

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>



<button class="ajax">Click Here</button>

<script type="text/javascript">



url: "/test/ajaxpro.php",

dataType: "json",

type: "POST",

data: {"id":"10"},

success: function (data) {



error: function() {








Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.