javascript - Service Call in client Side -
i need call service , retrieve resulted data in call function getting js error:
uncaught referenceerror: invoicehtmlservice not defined.
please - below pages , class
my aspx page
<%@ page language="vb" autoeventwireup="false" codebehind="invoicehtml.aspx.vb" inherits="webapplication2.invoicehtml" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>web service call client-side javascript</title> <script type="text/javascript"> function sendrequest() { debugger; invoicehtmlservice.getbillinvoicehtmldata(); } function oncomplete(arg) { alert(arg); } function ontimeout(arg) { alert("timeout has occured"); } function onerror(arg) { alert("error has occured: " + arg._message); } </script> </head> <body> <form id="form1" runat="server"> <asp:scriptmanager id="scriptmanager1" runat="server"> <services> <asp:servicereference path="~/service/invoicehtmlservice.asmx" /> </services> </asp:scriptmanager> <div> <input type="text" value="" id="mytextbox" /> <input type="button" value="send request web service" id="requestbutton" onclick="return sendrequest()" /> </div> </form> </body> </html>
my asmx page
imports system.web.script.services imports system.web.services imports system.collections.generic imports system.text imports system.drawing imports system.web.services.protocols imports system.componentmodel imports system.io imports classlibrary1 ' allow web service called script, using asp.net ajax, uncomment following line. ' <system.web.script.services.scriptservice()> _ <webservice()> _ <webservicebinding(conformsto:=wsiprofiles.basicprofile1_1)> _ <scriptservice()> _ public class invoicehtmlservice inherits system.web.services.webservice <webmethod()> _ public function getbillinvoicehtmldata() object dim objdaobill daoinvoice dim obj object objdaobill = new daoinvoice() obj = objdaobill.getbillinvoicehtmldata() return obj end function end class
i got answer everyone, posting answer may can others service call client side can done using complete class name present in .asmx page.in case
<%@ webservice language="vb" codebehind="invoicehtmlservice.asmx.vb" class="app.invoicehtmlservice" %>
so have call service in following way:
function sendrequest() { app.invoicehtmlservice.getbillinvoicehtmldata(callback); }
Comments
Post a Comment