Json 从jQuery调用Web服务将返回“;无运输”;错误

Json 从jQuery调用Web服务将返回“;无运输”;错误,json,web-services,jquery,Json,Web Services,Jquery,我有以下web服务 [WebMethod] public string HelloWorld() { return "Hello World"; } 我指的是最新的jquery库 <script type="text/JavaScript" src="Scripts/jquery-1.6.4.js"></script> 执行时,返回“无传输”错误。我添加了crossDomain:true仍然没有成功 提前谢谢 BB尝试使用 url: "AFARServic

我有以下web服务

[WebMethod]
public string HelloWorld()
{
    return "Hello World";
}
我指的是最新的jquery库

 <script type="text/JavaScript" src="Scripts/jquery-1.6.4.js"></script>
执行时,返回“无传输”错误。我添加了
crossDomain:true
仍然没有成功

提前谢谢 BB

尝试使用

 url: "AFARService.asmx/HelloWorld",



[WebMethod]
 [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string HelloWorld()
{
    return "Hello World";
}

要启用跨域调用,您可以尝试

jQuery.support.cors = true;
如果这不起作用,您可以通过(JSONP):



您可以遵循其中任何一项

服务器的响应,
“Hello World”
,不是有效的JSON!如果您在浏览器中查看
。/Service/AFARService.asmx/HelloWorld
,会发生什么情况?此处提出的类似问题可能会有所帮助?错误惊人地相似:
jQuery.support.cors = true;