如何使用jquery从其他项目中使用Web服务
我有两个项目我需要使用jquery来使用其他项目的asp.net web服务。当我在同一个项目中调用jquery时我能够访问它。但是当我尝试从另一个项目调用时无法得到它。控制没有转移到网络服务。我试过在IIS中托管网络服务。有什么设置吗?
请帮帮我这个
我尝试过:
var webserviceurl =http:// localhost:54666 /WebService.asmx/HelloWorld;
$ .ajax({
url:webserviceurl,
dataType:json,
类型:post,
contentType:application / json,
成功:function(){alert('hello');},
错误:function(e){alert(webserviceurl);}
});
I have two project i need to consume the asp.net web service of the other project using jquery.when i call the jquery within the same project i able to access it.but when i try to call from the other project i can't get it.control is not transferred to the web service.I have tried hosting web service in the IIS.Is there any setting??
please help me out with this
What I have tried:
var webserviceurl = "http://localhost:54666/WebService.asmx/HelloWorld";
$.ajax({
url: webserviceurl,
dataType: "json",
type: "post",
contentType: "application/json",
success: function () { alert('hello'); },
error: function (e) { alert(webserviceurl); }
});
.ajax({
url:webserviceurl,
dataType:json,
类型:post,
contentType:application / json,
成功:function(){alert( '你好'); },
错误:function(e){alert(webserviceurl); }
});
.ajax({
url: webserviceurl,
dataType: "json",
type: "post",
contentType: "application/json",
success: function () { alert('hello'); },
error: function (e) { alert(webserviceurl); }
});