我有一个关于jquery的问题。我的代码如下所示:
<button id="callConfirm'.$row['id'].'">DEL</button>
<div id="dialog" title="Realy?">
Realy delete '.$row['marks'] .' s váhou '.$row['weight'] .' z '.$row['id'] .' ?
</div>
<script type="text/javascript">
$("#dialog").dialog({
autoOpen: false,
modal: true,
buttons : {
"Opravdu" : function() {
alert("You have confirmed!"); },
"Ne" : function() {
$(this).dialog("close");
}
}
});
$("#callConfirm'.$row['id'].'").on("click", function(e) {
e.preventDefault();
$("#dialog").dialog("open");
});
</script>'
我需要点击 Opravdu 执行 delele.php 脚本,如下所示:
<?php
include 'conn.php';
$back = urldecode($_GET['back']);
$id = mysql_real_escape_string($_GET['id'] * 1);
mysql_query("DELETE FROM znamky WHERE id=$id");
?>
答案 0 :(得分:1)
"Opravdu" : function() {
$.get("delete.php?id=...&back=...",function(data) {
alert(data);
});
}
从删除
返回数据以下是您可能希望将ID传递给gialog的方法
jquery-ui, Use dialog('open') and pass a variable to the DIALOG