I'm encountering an issue with accessing my C# WebMethod in the code behind, resulting in a 500 internal server error. I cannot figure out why it's not working, so any assistance in identifying the problem would be highly appreciated.
https://i.sstatic.net/xdZYm.png
Even when data and datatype are not commented out, my ajax call doesn't seem to work.
$('#chkBxAutoCost')
.click(function(e) {
$.ajax({
type: "POST",
url: "BatchReportCriteriaSelection.aspx/GetAutoJsonBatches",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: "{}",
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("Request: " +
XMLHttpRequest.toString() +
"\n\nStatus: " +
textStatus +
"\n\nError: " +
errorThrown);
},
success: function() { console.log("success") }
});
}
);
This is the code behind method of the page:
[WebMethod]
public string GetAutoJsonBatches()
{
return autoJsonBatches;
}
A breakpoint set on this WebMethod is not being hit, leaving me puzzled. Any insights or suggestions would be greatly appreciated.