0
我已經啓用了CORS,嘗試了get和post方法,起初ajax調用工作正常,但現在它在瀏覽器中正常工作,但是當我在我的設備上測試它時,進入誤差函數,我也得到 錯誤=未定義 任何幫助,將不勝感激phonegap Ajax調用返回錯誤= undefined在android設備
$("#createEvent_btn").click(function(e) {
//alert("in the function ");
if ($("#registerInfo").valid()) {
$(this).addClass('ui-disabled');
start = $("#startDate").val();
end = $("#endDate").val();
venue = $("#place").val();
var data2 = $("#registerInfo").serialize();
var params = data2;
alert(params);
//console.log(data2);
var url = 'http://domain/th/registerEvent.php';
//ajax.open("POST", url, true);
//ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// ajax.setRequestHeader("Content-length", params.length);
//ajax.setRequestHeader("Connection", "close");
var modurl = url + "?" + params;
alert(modurl);
ajax.open("GET", modurl, true);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 && ajax.status == 200 || ajax.status == 0) {
//alert(ajax.response);
id = ajax.response;
alert(id);
$('#createEvent_btn').removeClass('ui-disabled');
setPeoplepage();
}
};
ajax.onerror = function(e) {
alert("Error ocurred. Error = " + e);
};
ajax.send(params);
}
});
你驗證了config.xml的白名單設置? – Amitesh 2014-10-20 09:52:57
是的,我做了,通過添加 –
2014-10-20 10:13:11