Home > DeveloperSection > Interviews > How do you invoke a web method of web service in AJAX?

Posted on    March-29-2011 9:47 AM

 AJAX AJAX 
Ratings:
 1 Answer(s)
  1702  View(s)
Rate this:

Varun Agrawal
Varun Agrawal

Total Post:159

Points:795
Posted on    March-29-2011 12:00 AM

In order to use a webmethod of a webservice, we need to add the reference of webservice in the <services> section of ScriptManager. Under services you have to configure the servicepath.

<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="..\service1.asmx" />
</Services>
</asp:ScriptManager>

Inside JAvascript Use methods of this service directly like
service1.methodname()

Don't want to miss updates? Please click the below button!

Follow MindStick