$.ajax({
type: "POST";, //GET or POST or PUT or DELETE verb
url: "http://localhost:41790/Service References/GetRentalItem.asmx", // Location of the service
data: '{"itemTypeid": ' + rentaltypeID + ',"businessid": ' + businessid + '}', //Data sent to server
contentType: "application/json; charset=utf-8", // content type sent to server
dataType: "json", //Expected data format from server
processdata: true, //True or False
success: function (msg) {//On Successfull service call
ServiceSucceededType(msg, ddlItem);
},
error: function (request, status, error) {
// When Service call fails
alert('error' + error);
alert('status' + request);
}
If you want to call ASMX Web Service in the local machine other than project, then you can publish the ASMX Web Service to the IIS. and try using something like the following URL:
rohit_kumar_...
Member
20 Points
8 Posts
How to Call Webservice(asmx) from Remote server or in the local machine other than project folder...
Mar 13, 2012 07:32 AM|LINK
I have created a asmx file and calling it from jquery which is working fine in the solution
but when i am creating a html file which is outside of the solution and calling the webservice from the
Html file it's not working
Also how to work when i upload the solution in the server.
Actually i want to invoke the webservice from outside the host server.
But neither i can figure out locally nor in the sever.
plese help.
vinay13mar
Star
7778 Points
1632 Posts
Re: How to Call Webservice(asmx) from Remote server or in the local machine other than project fo...
Mar 13, 2012 07:35 AM|LINK
provide the url of the webservice of hosted location
V.K.Singh
rohit_kumar_...
Member
20 Points
8 Posts
Re: How to Call Webservice(asmx) from Remote server or in the local machine other than project fo...
Mar 13, 2012 07:43 AM|LINK
yes i am providing the url but not working
something like below.
$.ajax({
type: "POST";, //GET or POST or PUT or DELETE verb
url: "http://localhost:41790/Service References/GetRentalItem.asmx", // Location of the service
data: '{"itemTypeid": ' + rentaltypeID + ',"businessid": ' + businessid + '}', //Data sent to server
contentType: "application/json; charset=utf-8", // content type sent to server
dataType: "json", //Expected data format from server
processdata: true, //True or False
success: function (msg) {//On Successfull service call
ServiceSucceededType(msg, ddlItem);
},
error: function (request, status, error) {
// When Service call fails
alert('error' + error);
alert('status' + request);
}
});
Peter pi - M...
Star
12871 Points
1786 Posts
Re: How to Call Webservice(asmx) from Remote server or in the local machine other than project fo...
Mar 15, 2012 03:05 AM|LINK
Hi,
If you want to call ASMX Web Service in the local machine other than project, then you can publish the ASMX Web Service to the IIS. and try using something like the following URL:
url: "http://localhost/IISApplicationAlias/GetRentalItem.asmx/yourwebmethodname", // Location of the service (assuming the alias name of application is IISApplicationAlias)
You could use Fiddler to test your web service and see the response whether it contains error information. Here is article regarding how to call ASMX web service using jquery.
http://www.codeproject.com/Articles/59551/Consuming-a-WCF-ASMX-REST-Service-using-jQuery#1
Regards,
Peter
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
rohit_kumar_...
Member
20 Points
8 Posts
Re: How to Call Webservice(asmx) from Remote server or in the local machine other than project fo...
Mar 15, 2012 05:45 AM|LINK
Finally I Solved it by using the help of below link
http://forums.asp.net/t/1647989.aspx/1?JqueryAjax+Webservice+and+Crossdomain+problem
http://www.west-wind.com/weblog/posts/2007/Jul/04/JSONP-for-crosssite-Callbacks
Before getting help from above links i was invoking the webservice from the host server itself using my previous posted code
which was in a js file on the host server.And i was calling the ajax function from Remote server.
But now it has been done ,it was a cross browser issue.
jenny1987
Member
2 Points
1 Post
Re: How to Call Webservice(asmx) from Remote server or in the local machine other than project fo...
Nov 20, 2012 12:03 PM|LINK
hi rohit,
can you explain in details how did u solved this issue.
i getting same error you but i am not able to solve this.
please please help.
thanks in advance.