title: jquery $.ajax to php problem
body: <p>i have two problems with jquery $.ajax.
  first problem is ihave a php file named action.php and here the code:</p>
  
  <pre><code>if($_GET['action']=='add'){
      //rest of the code here
  }
  </code></pre>
  
  <p>And i use jquery $.Ajax function to call that when form fills:</p>
  
  <pre><code>$.ajax({type:"POST", url:"action.php?action=add", data:$("#form").serialize(), cache:false, timeout:10000});
  </code></pre>
  
  <p>this works but i wanted to know is there anyway to send the action=add code with data and not the url?</p>
  
  <p>and the second problem that i have is that i have a link:</p>
  
  <pre><code>&lt;a href="#" onclick="delete(4);"&gt;delete row from mysql where id is 4&lt;/a&gt;
  </code></pre>
  
  <p>and a jquery function:</p>
  
  <pre><code>    function deleteUser(id){
      $.ajax({type:"POST", url:"action.php?action=delete", data:"id="+id, cache:false, timeout:10000});}
  </code></pre>
  
  <p>and of course the action.php code:</p>
  
  <pre><code>if($_GET['action']=='deletestudent'){
      mysql_query("DELETE FROM `students` WHERE `student_id` = {$_POST['id']}");
  }
  </code></pre>
  
  <p>but it doesn't work.what should i do?</p>