WebMethods For Use With Visual Studio and AJAX

The webmethod tag is an attribute added to a Public methods to indicate the method should be exposed as part of an XML Web service.  Below is an example of applying the WebMethod attribute.


<WebMethod()> _
Public Shared Function FunctionName(ByVal Parameter As String) As ObjectName
Dim ObjectName As Object = Object
Return ObjectName
End Function

The Web method can now be called via javascript on the client. Below is an example of calling the webmethod from the client.

PageMethods.FunctionName(Parameter1, onComplete, OnTimeOut, onError);

Here is a great link with additional information for web methods:

http://www.novologies.com/post/2009/05/06/Cleaner-Faster-Ajax-in-ASPNET.aspx