I am using jquery ajax call in asp.net,I have a static web method with some parameters, When I am trying to debug its not hitting the method, I saw in error log its showing parseError, I removed all parameters and checked,but still same error,
[WebMethod]
private static void AddData(int type, int categ, string desc, string date, string city, string state)
{
//Do Processing
}
I also tried with this,but same error
[WebMethod]
private static void AddData()
{
//do Processing
}
This is my ajax call
$.ajax({
type: "POST",
url: 'MyPage.aspx/AddData?type=' + encodeURIComponent(crimetype) + "&categ=" + encodeURIComponent(crimecateg) + "&desc=" + encodeURIComponent(desc) + "&date=" + encodeURIComponent(crimedate) + "&city=" + encodeURI(city) + "&state=" + encodeURIComponent(stateid),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
},
error: function (data, errorThrown) {
debugger
alert(errorThrown);
alert(data.toString());
}
});
I tried with this as well
$.ajax({
type: "POST",
url: 'MyPage.aspx/AddData',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
},
error: function (data, errorThrown) {
debugger
alert(errorThrown);
alert(data.toString());
}
});
All parameters are passing correctly