I write my code using ASP.NET MVC(Razor) and JS. I have a spreadsheet, from which I must get all content from class .
jtable-column-header
, and then send it to "/Template/DataGridSave/@ViewBag.TemplateGuid/@Model.Name"
controller with help of ajax.
I try to do this in that way:
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" );
}
}]
});
}
I call this function on form, but works only button "Close". When I press "Save" nothing happens. What's wrong?