title: AJAX pass 2 variables into the php file
body: <pre><code>&lt;script&gt;
  $(document).ready(function(){
      var id = 1;
      var name = "Abu";
  
      $.post("update.php", {id: id, name: name}, function(data)
      {
  
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>update.php</p>
  
  <pre><code>&lt;?php
      $id = $_POST['id'];
      $name = $_POST['name'];
  
      echo $id.'&lt;br /&gt;';
      echo $name.'&lt;br /&gt;';
  ?&gt;
  </code></pre>
  
  <p>From the above code, I want to use jquery pass the id and name from js to the update.php to update the record. However, I get the following error: <strong>Undefined index ...</strong>. What am I doing wrong?</p>