【问题标题】:Why dialog just works for the first time to open my dialog box?为什么对话框在第一次打开我的对话框时才起作用?
【发布时间】:2013-08-04 02:31:57
【问题描述】:

我有一个 div(mvc4 剃须刀):

<div onclick='dialogtrigger(this)'>send</div>

当用户点击此 div 时,它会在弹出对话框中加载视图并将其显示给用户。

当用户第一次点击它时它工作正常,之后当用户关闭对话框并想要再次重新打开它时它给了我这个错误:

0x800a01b6 - JavaScript runtime error: Object doesn't 
support property or method 'dialog'

我清理我的浏览器缓存并检查我的脚本文件是否不支持对话框为什么第一次工作?

我的功能代码:

$.ajax({
    url: "OpenSendDialog",
    type: "GET",
})
.done(function (result) {
    $("#clientdetailmodal").html(result).dialog({
        autoOpen: true, modal: true, show: {
            effect: "blind",
            duration: 500
        }
    });
});
}

在我的主要观点中:

<div id="clientdetailmodal"></div>

和我的控制器:

 [HttpGet]
 public ActionResult OpenSendDialog()
  {
    return view();
  }

【问题讨论】:

标签: asp.net-mvc-4 razor modal-dialog


【解决方案1】:

我认为你的功能和她的范围有问题......

here,希望对你有帮助:

var dialogtrigger=null; // global scope
$(function() {
  dialogtrigger = function (){
      //replace with your ajax call
      $("#clientdetailmodal").html($('#content')).dialog({
          autoOpen: false, modal: true, show: {
              effect: "blind",
              duration: 500
          }
      });      
  }

$( "#opener" ).click(function() {
  // or destruct your modal on close and re-call your ajax
  $( "#clientdetailmodal" ).dialog( "open" );

});

});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    • 2014-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-31
    相关资源
    最近更新 更多