Я изменил функцию, теперь она работает ...
$(document).ready(function () {
GetModuleList();
$("#btnSubmit").click(function () {
var myformdata = $("#form").serialize();
$.ajax({
type: "POST",
url: "/Setup/SaveModuleDataInDb",
data: myformdata,
success: function (result) {
if (result == true) {
alert("Success!...");
}
else {
alert("Something went be wrong!...");
}
$("#MyModal").modal("hide");
window.location.href = "/Setup/Module";
}
})
})
});
var GetModuleList = function () {
$.ajax({
type: "Get",
url: "/Setup/ModuleList",
success: function (response) {
BindDataTable(response);
}
})
}
var BindDataTable = function (response) {
$("#tableSort").DataTable({
"aaData": response,
"aoColumns": [
{ "mData": "Module" },
{ "mData": "ProjectID" },
{
"mData": "id",
"render": function (id, type, full, meta) {
return '<div class="text-center" onclick="AddEditEmployee(' + id +')"><a href="#" class="text-center" ><i class="fa fa-edit pa-5 text-warning"></i></a></div>'
}
},
{
"mData": "id",
"render": function (id, type, full, meta) {
return '<div class="text-center" onclick="DeleteModule(' + id + ')"><a href="#"><i class="fa fa-trash text-center pa-5 text-danger"></i></a></div>'
}
},
]
});
}