我使用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