Hello,
I have created visual web part for fetching data from SharePoint list and display on it.
For fetching data from list I have used server object model. For fetching data from SharePoint list I have created "Application Page" and written code in it.
In application page I have mentioned the method as a "[WebMethod]".I am calling application page method by using Ajax (i.e. from Sample.ascx page).
On search button I have written code for calling Application Page method "GetFilterResults" by using Ajax.
Problem is that when I click on search button it is giving error 500 Internal Server error that is Ajax is not calling "GetFilterResults" method it jumps to the "error method of Ajax".
One thing to mention is that, the code is working fine on Development, System Test and UAT environment only it is not working on "Production" environment.
Below is the sample code in Visual Web Part page (i.e. in Sample.ascx page).
What I have tried:
var parameters = { arrFilters: FilterArray, arrFilterCondition: FilterConditionArray };
$.ajax({
type: "POST",
async: false,
url: "/_layouts/15/BulkWorkflow/BulkWorkflowCode.aspx/GetFilterResults",
data: JSON.stringify(parameters),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var data1 = jQuery.parseJSON(response.d)
for (var i in data1) {
alert(data1[i].ContentID + ", " + data1[i].ContentName + " , " + data1[i].ContentTitle);
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert("Error");
alert(xhr.status);
alert(thrownError);
}
});
And code in Application page (i.e. in BulkWorkflowCode.aspx page),
[WebMethod]
public static string GetFilterResults(string[] arrFilters, string[] arrFilterCondition)
{
}
also I have checked the error logs in Fiddler tool
it is giving following error,
{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}