Reputation: 3
I'm using this class to set up a Yes/No alert.
http://myclabs.github.io/jquery.confirm/
This is my code:
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']; ?>
Upvotes: 0
Views: 163
Reputation: 222118
$.post("receive.php", { currentId: "id"} )
should be
$.post("receive.php", { id: currentId } )
Upvotes: 4