我有以下脚本: -
//--show add server dialog
$('body').on("click", "#addserver", function () {
//Make it a dialog box. Note that you don't have to do this every time the button is called, so you might want to make it dialog on document ready or something.
$("#showserveroptions").dialog({
title: "Add Exsisting Server",
width: 600,
height: 300
});
var ajaxCall = $.ajax({
url: '@Url.Content("~/Rack/showServers")',
data: {
rackid: "@Model.Rack.TMSRackID",
},
type: 'get',
success: function (html) {
$('#showserveroptions').html(html);
$("#showserveroptions").dialog("show"); //This could also be dialog("open") depending on the version of jquery ui.
}
});
});
在我的asp.net mvc中调用以下操作方法,对于流行的对话框: -
[CheckUserPermissions(Action = "Edit", Model = "Server")]
[OutputCache(CacheProfile = "NoCache")]
public PartialViewResult showServers(int rackid)//to display a view insdie the dialog box , for assigning servers to a rack
{
AddServerToRack s = new AddServerToRack { rackID = rackid };
return PartialView("_showServers", s);
}
目前该对话框在第一次打开时会正常工作,但在多次关闭/打开后我会有一段时间内容如下; -
有人可以建议吗? 感谢