我在论坛上发现了同样的问题,但无论如何我都无法修复它我有一个登录表单。就像是:
@using (Ajax.BeginForm("LogIn", "Account", null, new AjaxOptions
{
HttpMethod = "Post",
UpdateTargetId = "result",
InsertionMode = InsertionMode.Replace,
LoadingElementId = "loginspinner",
OnSuccess = "OnTryLogin"
}, new { id = "loginform"}))
{
<div>
<div class="editor-field">
@Html.TextBoxFor(m => m.UserName, new { id = "loginusername"})
@Html.ValidationMessageFor(m => m.UserName)
</div>
..............................
我显示弹出窗口(部分视图),例如:
$.get(loginaction, function (data) {
var div;
var divId = '#popupforlogin';
div = $(divId);
$(div).html(data);
$(div).dialog({
modal: true,
resizable: false,
autoOpen: false,
});
$(div).dialog('open');
// ....
}
我有:
function OnTryLogin(result) {
if (result.success == true) {
var fullPath = '@Url.Content("~/Account")' + '/LogOff';
var userName = result.userName;
$('#popupforlogin').dialog('close');
//......
}
所以问题是它dialog('close')
不起作用。
我错在哪里?