title: Passing variable from .js to PHP and then receiving a new var back in response?
body: <p>I'm creating variables on server 1 and then sending them via post to a mySQL database on server 2 using PHP file located on server 2.</p>
  
  <p>Javascript on server 1...</p>
  
  <pre><code>$.post( "http://www.website.com/xxx/update.php", { vote:currentVote, page:currentmatch, round:roundNumber, team1: firstTeam, team2: secondTeam });
  </code></pre>
  
  <p>PHP to receive post, located on server 2...</p>
  
  <pre><code>$round = $_POST['round'];
  //etc...
  
  //I then set the query and insert the data, no problem.
  </code></pre>
  
  <p>After that, and on the same PHP file, counting rows and assigning total to variable...</p>
  
  <pre><code>$result = $connection-&gt;query("SELECT * FROM {$page} WHERE 'vote' = {$team1}")) {
      $team1Count = $result-&gt;num_rows;
  }
  </code></pre>
  
  <p>How can I send that updated $team1Count variable back to the original page?</p>
  
  <p>Thanks!</p>