title: Jquery Onclick Send data to new opened window
body: <p>I know this is a common question but I can't find any answer.
  I have a PHP file which contains a link. When that link is clicked, I want to open another page in a new window, and on this newly opened page I want to get the ID attribute of the link clicked on the previous page.  </p>
  
  <blockquote>
    <p>Current page= 'patientreg.php'<br>
    Newpage to open in new window= 'patient_history.php'<br>
    Post data from current page to new loaded page.</p>
  </blockquote>
  
  <p>Current page Code:</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;a id="37" onclick="phistory(this.id);" href="#"&gt;View history&lt;/a&gt;  
  </code></pre>
  
  <p><strong>JavaScript:</strong></p>
  
  <pre><code>function phistory(myVar) {  
      var myurl = '../main/patient_history.php';  
      $.post(myurl,{data:myVar},function(){});  
      window.open(myurl,'_blank');                
  } 
  </code></pre>
  
  <p><strong>New page code:</strong></p>
  
  <pre><code>$phid = $_REQUEST["data"];  
  echo phid;
  </code></pre>
  
  <p>The problem is that it is not echoing the data on the next page, but I can see echo with the full new page in the Firebug response tab of the current page.</p>