Call a C# method with jQuery I attempted to invoke a C# method using jQuery but it failed. The reason is because the method cannot be found. However the method exist in the class. Did I miss something?
Your help is kindly appreciated.
Thank You
Attachments website.zip (75.46KB)
solomon_13000
Junior Poster in Training
88 posts since Jul 2009
Reputation Points: 24
Solved Threads: 0
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
Try using Page Methods or web services.
With Page Methods, you will not need to use jQuery.
http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx
Remember that your method needs to be static .
You mean I should replace the code below:
public string returnJson(){
tojson = Json.ToJSON(people);
return tojson;
}
To:
public static string returnJson(){
tojson = Json.ToJSON(people);
return tojson;
}
solomon_13000
Junior Poster in Training
88 posts since Jul 2009
Reputation Points: 24
Solved Threads: 0
I found the solution. You may review the attachment.
Attachments website.zip (75.44KB)
solomon_13000
Junior Poster in Training
88 posts since Jul 2009
Reputation Points: 24
Solved Threads: 0