如何在使用JQuery从可选菜单首次单击后显示对话框?

如何在使用JQuery从可选菜单首次单击后显示对话框?,jquery,ajax,dialog,jquery-ui-selectable,Jquery,Ajax,Dialog,Jquery Ui Selectable,我在初次单击后无法显示对话框。 以下是单击可选项时发生的情况: 第一次单击-无 第二次单击-第一次单击内容。关闭没什么 第三次单击-第一次单击内容。关闭后面还有一个对话 第二次点击内容。关闭没什么 循环重复前两个选择 以下是函数: $(function() { $('#selectable').selectable({ selecting: function (event, ui) { //Sends selectable title

我在初次单击后无法显示对话框。 以下是单击可选项时发生的情况:

  • 第一次单击-无
  • 第二次单击-第一次单击内容。关闭没什么
  • 第三次单击-第一次单击内容。关闭后面还有一个对话 第二次点击内容。关闭没什么
  • 循环重复前两个选择
以下是函数:

  $(function() {

    $('#selectable').selectable({

        selecting: function (event, ui) {
            //Sends selectable title to recieve information to fill dialog page.  
            $.post('ajax_receiver.php', 'val=' + ui.selecting.id, function (response) {
                //Fills div #contentWindow with jQuery's <div id='dialog'..>
                $("#contentWindow").html(response); 
            });  
           $("#content").html(ui.selecting.id);// get ra

            $( "#dialog" ).dialog({ modal: true });

            $( "#dialog" ).dialog( "open"); 
            $(event.target).children('.ui-selecting').not(':first').removeClass('ui-selecting');  

        }

    });

    //dialog box that holds informaiton
    $( "#dialog" ).dialog({
        autoOpen: false,
        show: {
            effect: "clip",
            duration: 500
        },
        hide: {
            effect: "clip",
            duration: 500
        }
    });

});
$(函数(){
$('#可选')。可选({
选择:功能(事件、用户界面){
//发送可选标题以接收信息以填充对话框页面。
$.post('ajax_receiver.php','val='+ui.selecting.id,函数(响应){
//用jQuery的
$(“#contentWindow”).html(回复);
});  
$(“#content”).html(ui.selecting.id);//获取ra
$(“#dialog”).dialog({modal:true});
$(“对话框”)。对话框(“打开”);
$(event.target).children('.ui-selecting').not(':first').removeClass('ui-selecting');
}
});
//保存信息的对话框
$(“#对话框”)。对话框({
自动打开:错误,
展示:{
效果:“剪辑”,
持续时间:500
},
隐藏:{
效果:“剪辑”,
持续时间:500
}
});
});

已解决。在应用到web页面之前,需要等待收到来自php的信息