使用jQuery的同步ajax调用在firefox上不工作
synchronous ajax call using jQuery not working on firefox
我试图使ajax调用设置异步属性为false,但它得到错误,而它在chrome和ie上工作。
我知道Firefox强烈推荐异步ajax调用由于用户体验问题,但我需要得到响应之前继续做其他事情和它的ok(和强制)等待,直到收到响应…
这里是工作和不工作的代码,任何帮助将不胜感激。
data = $.ajax({
url: Common.serverPath + 'recovery/list',
crossDomain: true,
dataType: 'json',
async: true,
type: 'GET',
contentType: 'application/json',
xhrFields: {
withCredentials: true
}
});
setTimeout(function(){ console.log(data.statusText);
},3000);
控制台:好的
data = $.ajax({
url: Common.serverPath + 'recovery/list',
crossDomain: true,
dataType: 'json',
async: false,
type: 'GET',
contentType: 'application/json',
xhrFields: {
withCredentials: true
}
});
setTimeout(function(){ console.log(data.statusText); },
3000);
console:InvalidAccessError:底层对象不支持参数或操作
chrome和ie都可以正常工作
我发现"跨域请求和dataType: "jsonp"请求不支持同步操作",即使在ie和chrome中也是如此:)
相关文章:
- 为什么这在IE中的工作方式与在Firefox中不同
- JS可以在Chrome中工作,但不能在Firefox中工作
- Facebook登录按钮没有'不能在Firefox上工作
- JS在firefox中无法正常工作
- firefox插件:退出不工作的应用程序观察器
- :focus:一起活跃,不在firefox上工作
- 加载Soundcloud嵌入式播放器OnClick在FireFox中不工作
- javascript()onclick隐藏元素-dos'我不在firefox工作
- 异步加载的SVG过滤器feColorMatrix在Chrome中工作,而不是在Safari或Firefox中
- Iframe加载调整大小在Chrome中工作,但不能在IE或Firefox中工作
- 按钮处于活动状态,焦点无法在Mac FireFox上工作
- HTML5 Canvas undo是'在IE或Firefox中无法正常工作
- 形式方法”;POST”;不在firefox工作
- Jquery倒计时显示NaN在Safari,在Chrome / Firefox工作良好
- IE 11似乎降低了.options的限制[]- firefox工作正常- IE <11工作正常
- javascript显示选项卡获胜'我不在firefox工作
- 登录功能没有'我不在firefox工作,但在chrome、IE、safari和opera上工作
- 尝试在html5中访问网络摄像头:Firefox工作,Chrome和Opera don't
- 在d3js布局中使用XML作为数据源;我不在firefox工作
- jquery切换不工作在chrome,但在IE和firefox工作