我正在使用cordova for Visual Studio 2013,没有任何问题。今天我安装了 VS2015 预览版并尝试移植我的项目,但遇到了一个简单的 Web 请求。
所以我创建了一个新项目来在干净的环境中测试这种行为。我添加了 jquery 和一个小脚本:
var url = "http://thetvdb.com/api/GetSeries.php?seriesname=The%20Walking%20Dead";
var request = $.getJSON(url, function(data) {
});
但我总是得到:
Failed to load resource: net::ERR_EMPTY_RESPONSE
在调试过程中,我可以看到请求的 url 以:
http://localhost:4400/ripple/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=
后跟我想要的网址。
config.xml 包含:
<access origin="http://thetvdb.com" />
<access origin="*" />
我还尝试在 jquery 调用之前添加它:
$.support.cors = true;
我不确定问题是否是我的错.. 但如果是,请告诉我 ;)
非常感谢您的帮助!