Ajax Call Not Returning Response From C# Code
Here is my jquery code var ajaxUrl = 'AjaxCallHandler.aspx'; function _init_Chart() { $.ajax({ type: 'GET', //GET or POST or PUT or DELETE verb url: ajaxUrl,
Solution 1:
Change the data type string to html or leave it empty for default type
Solution 2:
There a lot of missing things in your code.
You need to a static method marked with the attribute WebMethod
:
[WebMethod]
publicstatic RetrunValue Foo()
{
...
}
The data must be in json format in asp.net.
Solution 3:
Write the code in code behid in this way.
Response.Clear();
Response.Write("Your response in string");
Response.End();
Please not that if your response is in HTML you have to pass the string in Response.Write("Your String"), If your response is in Json Format write your code like this.
string json = JsonConvert.SerializeObject(List<object> of your code);
Response.Clear();
Response.Write(json);
Response.End();
Post a Comment for "Ajax Call Not Returning Response From C# Code"