|
Question : Using web service in javascript for asp.net ajax-enabled web site
|
|
Hi,
I created a web service project. In this I have namespace OrdersService and a method as follows:
========================================= namespace OrdersService { [ScriptService] [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService { public Service() {
//Uncomment the following line if using designed components //InitializeComponent(); }
[ScriptMethod] [WebMethod]
public int GetCount(string strCustID) { } =========================================
In in the same solution, I added a ajax-enabled web site and added the web service path as follows:
===================== =====================
now using the javascript I want to consume the web service, so I write:
var intOrderCount;
intOrderCount=0;
intOrderCount=OrdersService.Service.GetOrderCount(selectedValue);
But it gives error: OrdersService is undefined.
Second question I have is, some books mentioned that I need to create javascript proxy. So in the browser, I should add /js to the .asmx file. But if I do that I get error: Request format is unrecognized for URL unexpectedly ending in '/js'.
Any help on the above 2 issues?
Regards, mi
|
|
Answer : Using web service in javascript for asp.net ajax-enabled web site
|
|
|
|
|
|