title: Pass data to database using javascript Onclick
body: <p>I am a real noob when it comes to javascript/ajax, so any help will be very appreciated. 
  In reference to this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/638147/updating-a-mysql-database-using-php-via-an-onclick-javascript-function">Updating a MySql database using PHP via an onClick javascript function </a></p>
  
  <p>But mainly concerned with the answer left by <a href="https://stackoverflow.com/users/7094/phill-sacre">Phill Sacre</a>. I am wondering if someone could elaborate on how we are(if we can?) passing values/data through his example, using jquery.
  The code example left by him is as follows:</p>
  
  <pre><code>    function updateScore(answer, correct) {
  
        if (answer == correct) {
  $.post('updatescore.php');
  
    }
  }
  
  ...
  
  &lt;a onclick="updateScore(this, correct)" ...&gt; &lt;/a&gt;
  </code></pre>
  
  <p>Say for example, we are wanting to pass any number of values to the database with php, could someone give me a snippet example of what is required in the javascript function? Or elaborate on what is posted above please?</p>
  
  <p>Thanks again all.</p>