by Guest » 21 Dec 2024, 12:53
Ich möchte mein ASP.NET MVC-Formular mit jQuery in JSON serialisieren und dann einige Werte wie den Wert des Eingabefelds im Backend in C# deserialisieren, kann es aber nicht in JSON serialisieren. Bitte helfen Sie mir bei diesem Problem.
Hier ist mein Code:
$(function () {
$('#btnsearch').click(function (e) {
var searchname = $('#txtsearch').val();
var form = $(this).serializeArray();
DrawTable(form);
});
function DrawTable() {
var props = [];
props.push({ name: "FirstName", value: firstname });
BindDataTable({ AllowPaging: true, ShowFilter: false, ShowEditLink: true, EmptyTableText: 'No Data Found', SortIndex: 0, SortDirection: "asc" },
"#tblCustomers",
"@Url.Action("GetAllCustomers", "Customer")",
props,
[{ name: "Id", cellClass: "alignCenter", Sortable: true, index: 0 }, { name: "FirstName" }, { name: "ABN" }, { name: "Phone" }, { name: "Email" }, { name: "Address1" }, { name: "City" }, { name: "Country" }],
[{ name: "Id", type: "anchor", title: 'customerTable', viewtitle: 'View', link: '@Url.Action("Edit", "Customer")', index: 0 }]);
}
// DrawTable(data);
//$('#myInputTextField').on('keyup', function () {
// oTable.search($(this).val()).draw();
//});
});
Ich möchte mein ASP.NET MVC-Formular mit jQuery in JSON serialisieren und dann einige Werte wie den Wert des Eingabefelds im Backend in C# deserialisieren, kann es aber nicht in JSON serialisieren. Bitte helfen Sie mir bei diesem Problem.
Hier ist mein Code:
$(function () {
$('#btnsearch').click(function (e) {
var searchname = $('#txtsearch').val();
var form = $(this).serializeArray();
DrawTable(form);
});
function DrawTable() {
var props = [];
props.push({ name: "FirstName", value: firstname });
BindDataTable({ AllowPaging: true, ShowFilter: false, ShowEditLink: true, EmptyTableText: 'No Data Found', SortIndex: 0, SortDirection: "asc" },
"#tblCustomers",
"@Url.Action("GetAllCustomers", "Customer")",
props,
[{ name: "Id", cellClass: "alignCenter", Sortable: true, index: 0 }, { name: "FirstName" }, { name: "ABN" }, { name: "Phone" }, { name: "Email" }, { name: "Address1" }, { name: "City" }, { name: "Country" }],
[{ name: "Id", type: "anchor", title: 'customerTable', viewtitle: 'View', link: '@Url.Action("Edit", "Customer")', index: 0 }]);
}
// DrawTable(data);
//$('#myInputTextField').on('keyup', function () {
// oTable.search($(this).val()).draw();
//});
});