我正在使用这个类来设置是/否警报。
http://myclabs.github.io/jquery.confirm/
这是我的代码:
var currentId;
$(".confirm").click(function() {
currentId = $(this).attr('id');
});
$(".confirm").confirm({
text: "Are you sure?",
confirm: function(button) {
//if I alert here currentId, it alerts right
$.post("receive.php", { currentId: "id"} )
.done(function(data) {
alert(data); //NOTHING!!!
});
},
cancel: function(button) {
$('.modal hide fade').css("display", "none");
},
confirmButton: "Yes",
cancelButton: "No!",
post: true
});
});
接收.php
<? echo $_POST['id']; ?>