5
我想通過jquery刪除mysql中的特定行。它在第一行工作,但在第二行,沒有任何反應。我如何刪除mysql中的行表與jquery?
這是我的HTML代碼:
<td><p data-placement="top" data-toggle="tooltip" title="Delete">
<button id="dele_com" class="btn btn-danger btn-xs" name="<?php echo $rows['companyID']; ?>">
<span class="icon-trash"></span>
</button></p>
</td>
,這是我的jQuery代碼:
$("#dele_com").on("click", function(event) {
var show_id = this.name;
alert(show_id);
bootbox.dialog({
message: "Are you sure you want to Delete this account ?",
title: "<i class='icon-trash'></i> Delete !",
buttons: {
success: {
label: "No",
className: "btn-success",
callback: function() {
$('.bootbox').modal('hide');
}
},
danger: {
label: "Delete!",
className: "btn-danger",
callback: function() {
$.post('update_delete.php', { 'pid1':pid1 })
.done(function(response){
window.location.href= "modification.php";
})
.fail(function(){
bootbox.alert('Something Went Wrog ....');
})
}
}
}
});
});
'jquery'是客戶端,'mysql'是服務器端。你必須從客戶端使用'ajax',在調用數據庫查詢的服務器上調用一個php腳本。 – JustOnUnderMillions
你應該顯示你的'php'代碼,更具體地說你的'mysql'查詢。 – Nytrix
'pid1'應該從哪裏來?我想你想讓它成爲'show_id',對吧? – Jeff