簡體   English   中英

在JQuery對話框中打開文件加載

[英]Loading file on JQuery dialog open

我有一個JQuery對話框,里面正在加載部分視圖

       $("#WOdialog").dialog({
                    width: 765,
                    resizable: false,
                    closeOnEscape: true,
                    modal: true,
        close: function () {

        },
        open: function () {
              $(this).load("@Url.Action("AddWorkOrder")");
        }
      });

該部分視圖是常規的html文件,但其中包含一些<script></script>標記。 這里的問題是我的網站在本地運行,但未部署。 我懷疑這個錯誤

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

我知道這與async關鍵字和加載外部JS文件有關。 搜索了SO ,沒有任何解決方案對我有幫助。

$("#WOdialog").dialog({
            width: 765,
            resizable: false,
            closeOnEscape: true,
            modal: true,
close: function () {

    },
open: function () {
      //$(this).load("@Url.Action("AddWorkOrder")");
      //Try this
      var $self = $(this);
      var url  = '@Url.Action("AddWorkOrder")';
      $.ajax({
            url: url,
            cache: false,
            async: true
        })
        .done(function( html ) {
            $self.append( html );
        });
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM