Add php variable to ajax call <p>I have a form on <strong>page 1</strong> and I want to parse its variables to ajax call on <strong>page 2</strong>. The ajax call is triggered by on onload event.</p> <p>Scenario:</p> <p><strong>Page1</strong></p> <pre><code>&lt;form id="form1"method="GET" action="page2"&gt;//send the variables to page 2 &lt;input type="text" name="Place" value="city"&gt; &lt;input type="text" name="Type" value="room"&gt; &lt;input type="submit"&gt;&lt;/form&gt; </code></pre> <p><strong>page 2</strong></p> <pre><code>&lt;form name="myform2" id="myform2" method="GET"&gt; &lt;input type="text" name="Place" value="&lt;?php echo $_GET[Place] ?&gt;"&gt;// &lt;input type="text" name="type" value="&lt;?php echo $_GET[Type] ?&gt;"&gt; &lt;button id="submit2"type="submit" value="submit2" name="submit2" onclick="return ss()"&gt; </code></pre> <p>js1</p> <pre><code>$(document).ready(function(){ // load file.php on document ready function sssssss2(page){ var form2 = document.myform2; var dataString1 = $(form2).serialize() + '&amp;page=' + page; ({ type: "GET", url: "file.php",// data: dataString1, success: function(ccc){ $("#search_results").html(ccc); }});} sssssss2(1) ; $('#search_results .pagination li.active').live('click',function(){ var page = $(this).attr('p'); sssssss2(page); }); }); </code></pre> <p>js2 </p> <pre><code>function sss() {//serialize the form each time submitted. var form2 = document.myform2; var dataString1 = $(form2).serialize(); $.ajax({ type:'GET', url: "file.php", cache: false, data: dataString1, success: function(data){ $('#search_results').html(data); } }); return false; } </code></pre> <p>The problem is the <strong>file.php doens't take the variable "city" and "room"</strong>.I would like to parse the 2 variable to file.php when page2 load first time.</p> <p>Hw to parse those variable on document load page2?</p>