title: How to GET javascript data in PHP file without page reload
body: <p>I am building my best attempt at a twitter clone and have run into a bit of a problem.  I want to be able to click on a post and, without a page refresh, display that post in the overlay of the page (as you would on a twitter feed to look at replies, etc.).
  <br/><br/>
  In script.js, I check for a click and try to change the url.</p>
  
  <pre><code>$('body').on("click", ".chirp", function(){
   var uid = $_GET['id'];
   var pid = $(this).attr("id");
   var pidSplit = pid.split("chirp");
   var messageID = pidSplit[1];
   var obj = {foo: "status"};
   $('.chirpOverlay').addClass("active");
   window.history.pushState(obj, "Status", "profile.php?id="+uid+"&amp;status="+pid);
  });
  </code></pre>
  
  <p>The javascript works as intended...but as I will soon find out, the victory is short-lived.
  <br/>
  <br/>In profile.php, I attempt to GET the status id from the URL parameter.  </p>
  
  <pre><code>&lt;?php
  $status_id = $_GET['status'];
  $sql = $db-&gt;query("SELECT * FROM chirps WHERE id='$status_id'");
  if (mysqli_num_rows($sql) &gt; 0) {
    $c = $sql-&gt;fetch_object();
  }
  ?&gt;
  </code></pre>
  
  <p>This doesn't work because, as I've learned, using 'window.history.pushState' only changes the url- but doesn't load the page.  Thus the $_GET statement fails.  I need a way to get the id of the post I click on into profile.php without a page refresh.  Even if it means taking a different approach (instead of using a URL parameter).</p>
  
  <p>PS: I tried to do an XMLHttpRequest as well- to no avail. :(</p>
  
  <p>Thanks in advance!</p>