这是我的ajax调用:
$.ajax({
url: contextpath+'/servlet/AjaxManager?',
data: 'mode='+mode+'&phone='+phoneNo,
type: 'POST',
dataType: 'xml',
async: false,
success:function(xmlDoc) {
var message = xmlDoc.getElementsByTagName("message");
message = message[0].firstChild.data;
if(message == 'invalid') {
alert('invalid code entered');
} else if(message == 'valid') {
// security code is valid
var con = confirm('Are you sure to Proceed ?');
if(con==true) {
var conUsername=$("#country").val().concat($("#phone").val());
$("#frmRegistration").submit();
}
}
}, error:function(xmlDoc) {
alert('Error while checking security code validity');
}
});
每当调用时,控制直接移动到错误功能并显示错误警报。相同的代码也适用于其他浏览器和 android。
如果我改变:
async : true
然后它工作。
为什么使用 ipad ajax 同步调用不起作用?