 <p>Try this code.It gives some basic idea.Please feel free to ask any doubt in this code.</p> <p><strong>HTML CODE</strong></p> <pre><code> &lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#btn").click(function(){ var id=$("#id").val(); $.ajax({ type:"post", url:"action.php", datatype:"html", cache:false, data:"id="+id, success:function (response){ // alert(response); var data=response; $("#id").val(" "); $('#result').html(data); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;input type="hidden" name="id" id="id"&gt; &lt;/form&gt; &lt;button id="btn"&gt;Click here/button&gt; &lt;div id="result"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>action.php</strong></p> <pre><code>&lt;?php $id=$_POST['id']; $user_name = "root"; $password = "root"; $database = "mydb"; $server = "localhost"; $con = mysql_connect($server,$user_name,$password); mysql_select_db($database, $con) ; $sql="select * from mytable where id='$id'"; $result=mysql_query($sql); $var=mysql_fetch_row($result) { echo '$var['name']; } ?&gt; </code></pre> <p><strong>Working of code</strong></p> <p>On clicking the <code>button</code>,the hidden value in the form is sent to the <code>action.php</code> file with out page refreshment.And the response from the <code>action.php</code> is collected in the variable <code>data</code> and is displayed in the <code>div</code> having id as result.</p>