Reputation: 6540
There is a function in a class file name "User" in App_Code file. I need to access a function in the class
public static string GetUserRole(string returnValue)
from javascript which is placed in a seprate .js file in the folder name "js"
Please help
Upvotes: 0
Views: 544
Reputation: 6348
[WebMethod] public static string GetUserRole(string returnValue)
This guy explains it pretty good and has an example. http://decoding.wordpress.com/2008/11/14/aspnet-how-to-call-a-server-side-method-from-client-side-javascript/
Upvotes: 1
Reputation: 25505
The simplest way to accomplish this is to utilize page methods. I better way is to use a web services or expose the function though some type of http get method or a web service .
Upvotes: 1