Hi All,
I am just wondering if it is possible to call a page method or a static method (non webservice) with javascript and have it return the results to the calling javascript funciton just like how it is done with a webservice call? Personally I prefer not to be producing asmx's for things that may only be used on a single page.
If so ... how might I accomplish this?
If Not.... Why not?
hehe
Thanks
Hi miskiw
Yes you can do that, you can find details here
http://ajax.asp.net/docs/tutorials/useWebServiceProxy.aspx at the bottom of the page titled "To call a static page method".
It is worth noting that there is a bug with this in the current release where you can only call methods that are inline. You cannot currently make async calls to methods that are in code behind.
HTH
Andy.
http://ajax.asp.net/docs/tutorials/useWebServiceProxy.aspx
can't open.
can you give a sample?THX
The new address is:http://ajax.asp.net/docs/tutorials/ExposingWebServicesToAJAXTutorial.aspx
In the bottom of the page, you have the section Exposing Web Services from an ASP.NET Web Page.
Basically, what you need to do is to create a static method and apply the [WebMethod] attribute to it.
[WebMethod]public static string EchoString(string name) {return"Called by " + name +".";}
HTH,
MaĆra
No comments:
Post a Comment