我在本地apache实例(/ test)的页面上调用了一个函数,该实例使用jQuery.ajax调用子页面(/ test / info)并正确地进行AJAX调用并动态加载来自我桌面上的响应的内容FF,Safari,Chrome,但在iOS模拟器中,不会进行任何调用并刷新页面.
window.getInfo = function ( event ) {
console.log('1) prior to $.ajax');
$.ajax({
url: 'http://localhost/test/info',dataType: 'html',beforeSend: function(xhr) {
console.log('2) beforeSend');
},success: function(data,textStatus) {
console.log('3) success');
if ( textStatus == 'success' ) {
// doing stuff with data
}
}
}).always( function() { console.log('4) always'); });
};
从桌面浏览器打印所有日志,我的apache服务器在/ test报告请求,但在iOS模拟器中的Safari上,只打印’.ajax’之前的’1)和’2)beforeSend’日志.下一个对apache的请求是/ test.
有没有人知道这里发生了什么,以及如何使iOS表现自己?
更新:当我向ajax调用添加async:false属性时,将打印所有日志,并发出请求,以便基本解决问题;然而,页面仍然重新加载,我认为这是与iOS上的事件传播相关的不同问题.