title: Cannot call php delete from database using ajax
body: <p>I am new to javascript and ajax, I want to call php file which deletes the selected row from Mysql database in a javascript file so I tried to explore the answers I found here concerning this question but I couldn't resolve it, here is the php file called delete-consultation.php:</p>
  <pre><code>&lt;?php
  global $db;
  $idconsult=$_POST['del_id'];
  
     
      $q = $db-&gt;prepare(
          'DELETE FROM consultation
          WHERE id_consultation = :idc');
  
      $q-&gt;bindValue(':idc', (int)$idconsult , PDO::PARAM_INT);
      $q-&gt;execute();
  </code></pre>
  <p>And here is how I tried to call it using ajax:</p>
  <pre><code>$.ajax({
              url: &quot;delete-consultation.php&quot;,
              type: &quot;POST&quot;,
              cache: false,
              data:{
                  del_id: rows[0]
              },
              success: function(){
                  console.log(&quot;true&quot;);
              }
          });
  </code></pre>
  <p>I am getting 200 ok as a response but always without the id paraleter and the delete operation is not being executed, am I missing anything? Any advice could help, thanks</p>