Answer the question
In order to leave comments, you need to log in
Why doesn't asynchronous deletion of rows from sql table work?
The people implemented removal of a line from the table of a DB. In terms of deletion, everything works, but not asynchronously, as I did not try. Please help me figure it out.
The form:
<form id="delForm" method="post" action="journal_del.php">
<input type="text" class="hidden" name="unic" id="unic" value="'. $data['id'] .'" />
<button id="del_btn" class="btn btn-md btn-warning">Удалить</button>
</form>
include_once('db.php');
$unic_id = $_POST['unic'];
if (mysql_query("DELETE FROM test_kek WHERE `id`='".$unic_id."' "))
echo '<div class="alert alert-success" role="alert">Успешно удалено</div>';
else
echo '<div class="alert alert-danger" role="alert">Что то пошло не так :(.</div>';
$("#del_btn").click( function(){
$.post( $("#delForm").attr("action"), $("#delForm :input").serializeArray(), function(info){
$('#ajax_res').load('content.php');
});
});
$("#delForm").submit( function(){
return false;
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question