我正在使用此课程设置是/否警报。
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
});
});
Receive.php
<? echo $_POST['id']; ?>
答案 0 :(得分:4)
$.post("receive.php", { currentId: "id"} )
应该是
$.post("receive.php", { id: currentId } )