After passing parameter ajax call 500 Internal Server Occured
In MVC Using Ajax call Without passing parameter data getting successfullly but after pass parameter ajax call 500 Internal Server Occured
Not Working Code :
var AcadYear = $('#ddlAcadYear option:selected').val();
$.ajax({
type: "POST",
url: '@Url.Action("GetReportDetails", "RptStudentList")',
data: "{'AcadYear':'" + AcadYear + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
function OnSuccess(response) {
$("#tblShowDetails").DataTable(
{
bRetrieve: true
})
$("#tblShowDetails").DataTable(
{
"scrollY": 500,
"scrollX": true,
destroy: true,
bSort: true,
bPaginate: true,
dom: 'Bfrtip',
data: response,
columns: [{ 'data': 'str1' },
{ 'data': 'str2' },
{ 'data': 'str3' },
{ 'data': 'str4' },
{ 'data': 'str5' },
]
});
};
Working Code :
var AcadYear = $('#ddlAcadYear option:selected').val();
$.ajax({
type: "POST",
url: '@Url.Action("GetReportDetails", "RptStudentList")',
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
function OnSuccess(response) {
$("#tblShowDetails").DataTable(
{
bRetrieve: true
})
$("#tblShowDetails").DataTable(
{
"scrollY": 500,
"scrollX": true,
destroy: true,
bSort: true,
bPaginate: true,
dom: 'Bfrtip',
data: response,
columns: [{ 'data': 'str1' },
{ 'data': 'str2' },
{ 'data': 'str3' },
{ 'data': 'str4' },
{ 'data': 'str5' },
]
});
};
Sachin SinghPosted Apr 24, 2022, 5:39 PM
Ravinder SharmaPosted Apr 21, 2022, 2:35 AM
Madan ShekarPosted Apr 20, 2022, 2:24 PM