$.when问题-成功显示

Issue with $.when - success displaying

本文关键字:成功 显示 问题 when      更新时间:2023-09-26

嘿,伙计们,我有以下代码:

function run(){
    var url = '/pcg/popups/grabnotes.php';
    var tag = $("#dialog-container");
    var promise1 = showUrlInDialog(url);
    var promise2 = sendUserfNotes();
    $.when(promise1, promise2).done(function(data1, data2) {
      tag.html(data1).dialog({
          width: '100%',
          modal: true
        }).dialog('open');
       $('#notes_msg').text(data2[0].the_notes)
    });
}

这个很好。。。它将等待这两个函数在那之后运行,然后在JQuery UI中打开一个窗口-对话框标记.html…然后在该文件的文本区域字段中显示返回的注释。这很好接受我一直成功地显示在屏幕的左上角,我不知道如何摆脱它。如果你能帮我一把,我将不胜感激。

David

更新:

我弄清楚了原因:

tag.html(data1).dialog({
              width: '100%',
              modal: true
            }).dialog('open');

我不知道为什么?

当这打开对话框窗口时,成功这个词就在屏幕的左手边。

嘿,伙计们,我想好了:

tag.html(data1[0]).dialog({
              width: '100%',
              modal: true
            }).dialog('open');

我只需要将[0]添加到data1