I want to Serialize my MVC form to JSON using JQuery and then want to Deserialize some values like value of input field at backend in C# but i am unable to serialize it in json...Please help me in this issue.following is my code.
<script type="text/javascript">
$(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();
//});
});
</script>