Add Script Manager Instance to your ASPX Page, Here i have specified path of my webservice (test.asmx).
<asp:ScriptManager ID="_ScriptManager" runat="server">
<asp:ServiceReference Path="~/test.asmx" />
a ) Open the file test.asmx.cs then add below mentioned attribute to your code if it is not present
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
b ) create a public webmethod in the test.asmx.cs.
public string GetSum(int value)
return (value + 1).ToString();
okey, Now let us see how we can invoke this webmethod from javasript.
Define result Handler Function as Depicted in above code