0

我正在使用这个类来设置是/否警报。

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']; ?>
4

1 回答 1

4
$.post("receive.php", { currentId: "id"} )

应该

$.post("receive.php", { id: currentId } )
于 2013-05-14T15:20:11.313 回答