【发布时间】:2011-02-24 12:18:48
【问题描述】:
我使用 Phonegap 在 Android 上开发了一个示例应用。
单击按钮时,将向服务器发出 Ajax 请求 (http://192.168.0.199:8080/test.php)。
test.php 只是与 hello world 相呼应。
我正在使用 Jquery 1.5 进行 Ajax 调用。
这里是 Ajax 调用的代码:
$.ajax({
url:"http://192.168.0.199:8080/test.php",
beforeSend: function(x) {
alert("The URL "+url);
},
type:'POST',
crossDomain: true,
success:function(data) {
alert(data);
},
error:function(XMLHttpRequest,textStatus, errorThrown) {
alert("Error status :"+textStatus);
alert("Error type :"+errorThrown);
alert("Error message :"+XMLHttpRequest.responseXML);
}
});
但是,每次调用这个函数,都会抛出一个错误:
Error Type: No TransportError Message: undefinedError Status: error
注意:我在 Manifest 文件中添加了 INTERNET 权限。我使用的是运行 Android 1.6 的 G1 设备
提前致谢
【问题讨论】: