笔记:前端警告:Synchronous XMLHttpRequest on the main thread is deprecated

chrome控制台 提示禁告:Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

解释: 这个警告并不是错误,不是逻辑和代码错误;而是浏览器检测出来的一种不建议写法和用法的一种警示,完全不影响程序的执行和正常运行!

原因是我的ajax执行了同步操作,即async设置为False,当然它并不影响程序的运行 。因为我要在ajax() 外边 获取ajax取得的值,所以必须设置为async为false。但是看这个警告不爽,我改进了方法,写到里边去了,把同步改成了异步,就好了。

参考以下文章:

关于chrome控制台警告:Synchronous XMLHttpRequest on the main thread终极解决办法

 

你可能感兴趣的:(前端)