如何使用jquery从其他项目中使用Web服务 [英] How can i consume the web service from the other project using jquery

查看:58
本文介绍了如何使用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); }
});


这篇关于如何使用jquery从其他项目中使用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆