title: Why is my jQuery condition not working?
body: <p>I am using ajax to insert data into a MySQL database with php. Once the data is succesfully inserted into the database I want to trigger an alert using a condition. </p>
  
  <p>I can't figure out why my condition in jquery is not working. The php side of things is working fine and returns the 'success' response which I can see in an <code>alert()</code> but not when I use the condition. 
  Hopefully someone can show me what I have gotten wrong, thanks.</p>
  
  <p>The jquery</p>
  
  <pre><code> submitHandler: function (form) { 
  
  var formdata = $("#edit_post").serialize();
      $.post('edit_upload.php', formdata,
             function(data){
  
              if(data =="success"){ //alert if records inserted
              alert(data);
     }
  });
  return false;
  }
  </code></pre>
  
  <p>edit_upload.php</p>
  
  <pre><code>//Update Database 
  $stmt = $db_conx-&gt;prepare('UPDATE tbl_uploads SET title=?, detail=? WHERE id=?');
  $stmt-&gt;bind_param('sss',$title,$detail,$id);
  $stmt-&gt;execute();
  
  if ($stmt-&gt;execute()) { //true
  echo 
           'success';
  }
  
  else{ echo "error"; }
  </code></pre>