我使用Phonegap在Android上开发了一个示例应用程序。
单击按钮时,向服务器发出Ajax请求(http://192.168.0.199:8080/test.php)。
The test.php只是回声hello world。
我正在使用Jquery 1.5进行Ajax调用。在Android上发出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 Transport
Error Message: undefined
Error Status: error
注意:我在Manifest文件中添加了INTERNET权限。我使用运行Android 1.6
感谢G1设备提前
嗨艾瑞克,我能够访问浏览器上的网址......绝对不是网络问题。 – bitblt 2011-02-24 13:33:55
它运行良好** ** Android 2.2上的**三星Galaxy S ** **也许这是一个版本问题... G1运行在Android 1.6上** ** – bitblt 2011-02-25 09:01:49