I am having an issue hitting my C# WebMethod on the code behind and getting 500 internal server error. I don't really understand why it won't hit it so it would be really great if someone could tell me what is the problem.
So this is my ajax call and doesn't work even with data and datatype not commented out.
$('#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") }
});
}
);
And this is my code behind method of the page:
[WebMethod]
public string GetAutoJsonBatches()
{
return autoJsonBatches;
}
So I have attached a breakpoint on this WebMethod and it's not being hit. I am pretty stuck so if someone had any insight I'd greatly appreciate it.