Hello Friends, I save and also update data from my controller to the Table directly and everything work fine befor I decided to pass the data from controller through view model to the database, but after the changes the data Fails to save and update.
HTML PAGE
function saveCategory() {
var model = new Object();
model.CategoryId = $("#categoryId").val().trim();
model.CategoryName = $("#categoryName").val().trim();
model.Status = $("#status").val().trim();
var data = JSON.stringify({
model: model
})
return $.ajax({
contentType: 'application/json; charset=ut-8',
dataType: 'json',
type: 'POST',
url: "/Home/SaveCategory",
data: data,
success: function (result) {
if (result == true) {
dataTable.ajax.reload();
}else {
swal("Save Failed!")
}
},
error: function () {
swal("Error!")
}
});
}