我使用ASP.NET MVC(Razor)和JS编写代码。我有一个电子表格,我必须从中获取所有内容。
jtable-column-header
,然后在ajax的帮助下将其发送到"/Template/DataGridSave/@ViewBag.TemplateGuid/@Model.Name"
控制器。
我试着这样做:
function createSaveDialog_@(Model.Name)()
{
// Creating diallog form
$( "#dialog_@Model.Name" ).dialog({
resizable: false,
autoOpen: false,
minHeight: 400,
closeText: "Close",
modal: true,
buttons: [{
// Button, that must send content of "th.jtable-column-header"
text: 'Save',
"class":'btn btn-primary pull-left',
click: function() {
var abc = $('th.jtable-column-header');
$.ajax({
url: "/Template/DataGridSave/@ViewBag.TemplateGuid/@Model.Name",
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: abc,
});
}},
{
text: 'Close',
"class":'btn btn-primary pull-right',
click: function() {
$('#DataGridView_@Model.Name').data({RecordEdit:null});
$( this ).dialog( "destroy" );
}
}]
});
}
我在表单上调用此函数,但仅按“关闭”按钮。当我按“保存”时没有任何反应。 怎么了?