title: Jquery pass variable to post without form?
body: <p>In my superuser page for delete and modify my users I done in this way</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
         &lt;td&gt;USERID&lt;/td&gt;
         &lt;td&gt;NAME&lt;/td&gt;
         &lt;td&gt;AGE&lt;/td&gt;
         &lt;td&gt;DELETE&lt;/td&gt;
         &lt;td&gt;MODIFY&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;?php
  
      $base_url = 'this_page.php';
  
      $query = "SELECT * FROM tbl";
      $result = mysql_query($query);
      while ($row = mysql_fetch_array($result)) {
  
  
      $btn_del = "&lt;input type='button' ";
      $btn_del .= "onClick=\"location.href='" . $base_url . "&amp;action=Delete&amp;id=$row[userid]'\" ";
      $btn_del .= "class='deluser' /&gt;";
  
      $btn_mod = "&lt;input type='button' ";
      $btn_mod .= "onClick=\"location.href='" . $base_url . "&amp;action=Modify&amp;id=$row[userid]'\" ";
      $btn_mod .= "class='moduser' /&gt;";
  
      echo "&lt;tr&gt;\n";
          echo "&lt;td&gt;" . $row['userid'] . "&lt;/td&gt;\n";
          echo "&lt;td&gt;" . $row['user'] . "&lt;/td&gt;\n";
          echo "&lt;td&gt;" . $row['age'] . "&lt;/td&gt;\n";
          echo "&lt;td&gt;" . $btn_del . "&lt;/td&gt;\n";
          echo "&lt;td&gt;" . $btn_mod . "&lt;/td&gt;\n";
      echo "&lt;/tr&gt;";
  
  
      }
  
  &lt;/table&gt;
  
  
      &lt;?php
  
      switch ($_GET['action']) {
  
      case "Delete":
  
          // call delete method of user class
          $obj-&gt;DeleteUser($_GET['idric']);
  
          echo "&lt;script&gt;";
          echo "document.location.href=\"$base_url\"";
          echo "&lt;/script&gt;";
  
          break;
  
      case "Modify":
  
          // call modify method of user class
          $obj-&gt;ModifyUser($_GET['idric']);   
  
          echo "&lt;script&gt;";
          echo "document.location.href=\"$base_url\"";
          echo "&lt;/script&gt;";
  
          break;
  
      }               
  
      ?&gt;
  </code></pre>
  
  <p>This way works decently, but I'd like to do something more elegant, perhaps using jquery post and / or ajax.</p>
  
  <p>Until now I have used jquery passing data through forms (for validate).</p>
  
  <pre><code>// # Form Submit
  $(".Form").submit(function( event ) {
  
  event.preventDefault();
  
  $.post("action.admin.php", {
  
    name: $("#name").val(),
    age: $("#age").val(),
    userid: $("#userid").val()
    },
  });
  </code></pre>
  
  <p>How could I do to pass my data to action.php (in this case, $userid) without using a form with jquery post? </p>
  
  <pre><code>// # click
  $(".deluser").click(function( event ) {
  
   event.preventDefault();
  
  $.post("action.php", {
  ??
  ??
  </code></pre>
  
  <p>Thanks</p>