我有一个 jquery 对话框,在其中我加载了两个部分视图,一个简单的主/详细信息,当我在保存详细信息后返回主视图时,单击按钮没有响应。
我发布了一些代码:
掌握
$('#dialogActivities').dialog({
autoOpen: false,
open: function (event, ui) {
var id = $(this).data('id');
var urlList = '@Url.Action("ActivityList", "Contacts")';
$(this).load(urlList, function ()
{
$(".k-grid-ActivityEdit").bind("click", function ()
{
var grid = $("#gridYear").data("kendoGrid");
var selectedData = grid.dataItem(grid.select());
if (selectedData)
{
var urlEdit = '@Url.Action("ActivityEdit", "Contacts")';
$('#dialogActivities').dialog().load(urlEdit);
}
});
});
}
});
细节
$(document).on('submit', '#frmActivityEdit', function ()
{
$.ajax({
cache: false,
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result)
{
if (result.success)
{
var model = @Html.Raw(Json.Encode(Model));
var urlList = '@Url.Action("ActivityList", "Contacts")';
$('#dialogActivities').dialog().load(urlList);
}
}
});
return false;
});