WebService Is Undefined Error In ASP.NET 4.0
1. First step is to add reference to the web service using Ajax Script Manager:
2. Secondly is to include the namespace in calling the webservice method
From
To
Reference: http://omensblog.blogspot.com/2007/07/aspnet-ajax-web-service-calls-from.html
Greg
<asp:ScriptManager ID="ajaxManager" runat="server"> <Services> <asp:ServiceReference Path="~/Services/ProductService.asmx" /> </Services> </asp:ScriptManager>
From
ProductService.GetProducts(
function (data) {
$.each(data, function (index, elem) {
$("<option />")
.text(elem.ProductName)
.val(elem.ProductID)
.appendTo("#products");
});
}
);
AccessingServerSideDataUsingClientScript.Services.ProductService.GetProducts(
function (data) {
$.each(data, function (index, elem) {
$("<option />")
.text(elem.ProductName)
.val(elem.ProductID)
.appendTo("#products");
});
}
);
Reference: http://omensblog.blogspot.com/2007/07/aspnet-ajax-web-service-calls-from.html
Greg
Comments
Post a Comment