You use the ScriptMethod attribute in the following two scripts.
- You are using jquery or any other ajax request mechanism, but you want the request to be GET, not POST.
- You want to receive a processed XML response in javaScript.
If you do not have one of the above requirements; you just need a JSON response using an ajax request, then you can just use WebMethod.
Is there another confusing element here when you use the ScriptService attribute? this is used if you are using the Microsoft Ajax Client script infrastructure, these attributes tell the server to generate proxy objects on the client so that you can call functions just like a regular object. var MyRemoteObject = new RemoteObject(); MyRemoteObject.getMessage(....) , and even if you use the ScriptService attribute, you do not need to add the ScriptMethod attribute only in the above scripts.
This baffled me at the beginning, because I thought the ScriptService and ScriptMethod attributes work together the same as the WebService and WebMethod attributes.
Useless Hasid Feb 11 '10 at 18:55 2010-02-11 18:55
source share