title: How to refresh a div tag without losing the posted data using AJAX and PHP
body: <p>Now I got two pages HTML page that contains Ajax refresh div tag code and posted data from another page using <code>$_POST</code> and the second page is PHP page that Select data from a mysql table, So let's see the code that I use to reload a div tag using AJAX:</p>
  
  <pre><code>function Ajax(){
  var xmlHttp;
      try{    
          xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
      }
      catch (e){
          try{
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
          }
          catch (e){
              try{
                  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
              catch (e){
                  alert("No AJAX!?");
                  return false;
              }
          }
      }
  
  xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
          document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
          setTimeout('Ajax()',2000);
      }
  }
  xmlHttp.open("GET","data.php",true);
  xmlHttp.send(null);
  }
  
  window.onload=function(){
      setTimeout('Ajax()',2000);
  }
  </code></pre>
  
  <p>That code reload this div tag <code>&lt;div id="ReloadThis"&gt;&lt;/div&gt;</code> and get what from the <code>data.php</code> file and reload it into this div tag, that is awesome but my issue that in the PHP file contains a posted data when it reload the posted data is lost and shows me <code>Undefined index</code>. I searched on google how to do this, I found to use <code>$.post</code> in AJAX, So is <code>$.post</code> is useful for that issue, if yes so how can I use it?</p>
  
  <p>Thanks :)</p>