单击按钮时jquery对话框出现问题

时间:2015-02-03 09:01:20

标签: jquery

我已经尝试过这个问题中提到的事情jquery ui: cannot call methods on dialog prior to initialization; attempted to call method 'close'但是当我点击" Da"时,它并没有帮助我仍然得到同样的错误。按钮是:

未捕获错误:在初始化之前无法调用对话框上的方法;试图调用方法'关闭'

有谁知道我做错了什么?

$(document).on('click', '#brisanje', function () {
    $(function () {
        $("#dialog-confirm").dialog({
            resizable: false,
            height: 'auto',
            modal: true,
            buttons: {
                Da: function () {
                    var $close = $(this);
                    $.post("ajax.php", {
                        mode: 8,
                        postID: $("#hidden_id").val()
                    }, function (response) {

                        $close.dialog("close");
                        searchData();
                    }); 
                },
                Ne: function () {
                    $(this).dialog("close");
                }
            }
        });
    });
});

searchData()的代码

function searchData()
{
    $.post("search.php", {
           mode: 1,
           postSelect: $('#select').val()              
    }, function (response){         
            $('#results').html(response);               
    });             
}

0 个答案:

没有答案