Ajax Code
$.ajax({
type: "POST",
url: "LiveFeed.aspx/SearchStateList",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
$("#Content").text(response.d);
},
failure: function (response) {
alert(response.d);
}
});
Code Behind
[WebMethod]
public static string SearchStateList()
{
}
The above code works fine and the code behind is called
But when I send some parameter as given below, code behind is not invoked and when I see the Firebug console errors, it throws
NetworkError: 500 Internal Server Error - http://localhost:61276/App/LiveFeed/LiveFeed.aspx/SearchStateList
Ajax Code
$.ajax({
type: "POST",
url: "LiveFeed.aspx/SearchStateList",
contentType: "application/json; charset=utf-8",
data:{value:"samplevalue"},
dataType: "json",
success: function (response) {
$("#Content").text(response.d);
},
failure: function (response) {
alert(response.d);
}
});
Code Behind
[WebMethod]
public static string SearchStateList(string value)
{
}
I also tried to change modify the data of ajax call as
var param={value:"samplevalue"}
data:JSON.stringify(param),
and also tried directly with out JSON.stringify
data:param,
Every time when I tried to pass a parameter it did not invoke code behind and 500 error is thrown.