1

我有一个从数据库中删除画廊的表格。代码一直有效,直到几周前,我不得不从 jquery.interface 切换到 jquery-ui 时遇到其他问题,但是现在当我尝试将更改重新提交到 svn 时出现错误。无效的属性 ID。引发错误的行是这样的:

post:$("#post").val(), delete:true

整个代码片段是:

var answer = confirm("This will permanently delete this entire gallery. Are you sure you want to proceed?");
    if (answer) {
        $.post(
            "admin-ajax.php?action=gallery_submit",
            { post:$("#post").val(), delete:true },
            function(data){
                if (data == 1) { //success
                    $('body').html('<div class="success">Your gallery has been successfully deleted.</div>');
                    setTimeout(function() { tinyMCEPopup.close(); }, 2000);
                } else { //error
                    alert('There was an error with deleting your gallery, and so, it was NOT deleted.\n\r\n\rThe following error was encountered:\r\n' + data);
                }
            }
        );

是否对 $.post 进行了一些我不知道的语法更改,我检查了文档并没有看到任何匹配的内容。

4

1 回答 1

3

删除是一个保留字,所以你必须引用它。

 { post:$("#post").val(), "delete":true },
于 2013-04-24T00:21:46.640 回答