【发布时间】:2014-03-20 06:06:24
【问题描述】:
我在这里有一个通过 ajax 删除的记录。如果我想删除记录,我会添加确认消息。我需要的是将确认消息更改为模态对话框http://jqueryui.com/dialog/#modal-confirmation。
我想更改这个 javascript 代码
if(confirm("All PR and PO in this record will be deleted. Are you want to delete?"))
进入这个 jquery 模态对话框。有什么帮助吗?
<script>
$(function () {
$("#dialog-confirm").dialog({
resizable: false,
height: 140,
modal: true,
buttons: {
"Delete all items": function () {
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
</script>
Ajax 删除
<script>
$(function () {
$(".delbutton").click(function () {
//Save the link in a variable called element
var element = $(this);
//Find the id of the link that was clicked
var del_id = element.attr("name");
//Built a url to send
var info = 'name=' + del_id;
if (confirm("All PR and PO in this record will be deleted. Are you want to delete?")) {
$.ajax({
type: "GET",
url: "delete.php",
data: info,
success: function () {}
});
$(this).parents(".record").animate({
backgroundColor: "#fbc7c7"
}, "fast")
.animate({
opacity: "hide"
}, "slow");
}
return false;
});
});
</script>
【问题讨论】:
标签: javascript jquery