我正在创建一个phonegap测试应用程序,因为我希望通过webservice(.asmx)从数据库获取数据。我对这项技术更新。我已经花了2天的时间来打电话这是无法做到的。
function test() { jQuery.support.cors = true; $.mobile.allowCrossDomainPages = true; $.ajax({ data: "{}", type: "GET", dataType: "json", contentType: "application/json; charset=utf-8",
url: "http://localhost:xxxxx/yyyy/testservice.asmx?op=testfunction", success: function (msg) { $('#divToBeWorkedOn').html(msg.text); }, error: function (e) { $('#divToBeWorkedOn').html("unavailable"); } }); }
当地的服务。
答案 0 :(得分:1)
我会将http://localhost:xxxxx/
替换为服务器的实际内部IP地址(可能类似于http://192.168.x.x:xxxxx/
) - 只需确保您的服务器和移动设备通过Wi-Fi连接到同一网络gsm网络。
还要确保您更新了域名白名单。更多信息如何在http://docs.phonegap.com/en/2.2.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide