如何在mvc中加载弹出窗口?

How to load a popup in mvc?

当前行为:我有一个带有按钮 "Import" 的主页,单击该按钮时会显示一个弹出窗口 window。如果我退出弹出窗口并返回主菜单,我再次单击 "Import" 按钮,它会显示弹出窗口 window(没有更新)。

注:

  1. 这不是页面刷新的原因,即使页面刷新了也一样。
  2. 强制应用程序更新 "Import" 的唯一方法是退出并 return 进入应用程序。

如果您有任何建议,请给我。我的代码如下所示:

function ImportData() {
$("<div></div>")
    .addClass("dialog")
    .attr("id", $(this)
    .attr("data-dialog-id"))
    .appendTo("body")
    .dialog({
        title: $(this).attr("data-dialog-title"),
        close: function () { $(this).remove(); },
        modal: true,
        position: ['center',200],
        height: 250,
        width: 800,
        resizable: false,
        left: 0
    })
   .load("/Index/ImportCase");

我的 html 按钮:

   <button onclick="ImportData()" class="MenuPageButton" data-dialog-id="CaseImportData" data-dialog-title="Case Selection (Upload)"> Import Data </button>.

请优先选择我在下面提到的link,在此您可以根据需要在弹出窗口中调用pertialview。

MVC-pop up windows

你有两个选择,关闭全局缓存

// make sure this is called before any of your ajax call is called
$.ajaxSetup ({
// Disable caching of ajax responses
cache: false
});

或使用更长的加载形式

$.ajax({
url: '/Home/MyActionMethod?id=' + id,
cache: false
});