• 警告

  • 原因

ajax同步请求会触发此警告

  • 分析

这段英文翻译:主线程上的同步XMLHttpRequest不受欢迎,因为它对最终用户的体验有害;

ajax同步,在向后台请求的过程中,前台代码执行会停留在ajax代码块中,直到请求成功才会执行ajax代码块之后的代码;

ajax异步,在向后台请求的过程中,在等待后台执行这个过程中,前台会继续 执行ajax块后面的代码,这是执行ajax代码块的是一个线程,执行ajax代码块后面代码的是另一个线程。

  • 解决

ajax设置为异步即可,aysnc:true 默认为异步。

更详细解释可参考:https://blog.csdn.net/sky786905664/article/details/53079487

chrome警告:Synchronous XMLHttpRequest on the main thread的更多相关文章

  1. 关于chrome控制台警告:Synchronous XMLHttpRequest on the main thread

    Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to th ...

  2. Ajax.html:35 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org

    AJAX的容易错误的地方 Ajax.html:35 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated ...

  3. Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental……

    Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to th ...

  4. jquery.js:8672 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

    html5谷歌流浪器报错:jquery.js:8672 Synchronous XMLHttpRequest on the main thread is deprecated because of i ...

  5. Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more jquery-1.12.4.js:10208

    ajax执行请求之后返回了数据但是不执行success()函数,原因是返回得数据类型不是ajax请求中设定的:dataType:"json",因为是一个Map<Object, ...

  6. iOS Main Thread Checker: UI API called on a background thread的解释

    Xcode打印栏出现如下警告: Main Thread Checker: UI API called on a background thread 这个是什么错误呢? 其实这并不一定是错误,也可以理解 ...

  7. Why NSAttributedString import html must be on main thread?

    The HTML importer should not be called from a background thread (that is, the options dictionary inc ...

  8. 13、主线程任务太多导致异常退出(The application may be doing too much work on its main thread)

    今天花费了一天的时间来解决这个bug. 这种在程序运行期间出现的问题比较棘手,如果再没有规律的话就更难解决. 还好这个bug是由规律的,也就是说在程序执行半个小时左右后就会因为此异常而导致程序退出:那 ...

  9. reloadData should be in main thread

    reloadData should be called in main thread, so if you call it in work thread, you should call it as ...

随机推荐

  1. 2 Struts2的执行流程&配置文件的加载顺序

    执行流程: 访问前段页面,通过url访问action 访问xml中Struts2核心过滤器,并执行一组拦截器(这组拦截器在struts-default.xml中,实现了部分功能) 通过action配置 ...

  2. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 表格:联合使用所有表格类

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  3. uniapp - 导航切换(样式)

    <view class="text-area" v-for="(menu,i) in menus" :key="i" v-show=& ...

  4. 0-1背包问题(0-1 knapsack problem)

    0-1背包问题描述:一个正在抢劫商店的小偷发现了n个商品,第i个商品价值 vi 美元,重 wi 磅,vi 和 wi 都是整数.这个小偷希望拿走价值尽量高的商品,但他的背包最多能容纳 S 磅重的商品,S ...

  5. [理解] Linux 作为一个服务器是怎样的存在 (一)

    长期以来我就一直有一个疑问, 为什么当我们选择使用服务器的时候都会选择 Linux 作为操作系统, 以至于只要说到服务器就会不由自主的想到Linux, 那么Linux到底是什么呢? 当然我也不会妄谈天 ...

  6. Python 面试问答 Top 25

    Python 是一种解释型,交互式,面向对象的高级编程语言.和别的一些使用标点符号的语言不同,Pythons使用了大量的英语单词作为关键字,因而具有很好的可读性.而且跟其他编程语言相比,它有更少的语法 ...

  7. IE 样式属性前后缀兼容写法略统计

    总结 IE 兼容写法: \9: IE6 IE7 IE8*: IE6 IE7_: IE6*+: IE7 ---------------------------------- 书写位置: backgrou ...

  8. 【转】干货分享-100个shell脚本

    本文用于记录学习和日常中使用过的shell脚本 [脚本1]打印形状 打印等腰三角形.直角三角形.倒直角三角形.菱形 #!/bin/bash # 等腰三角形 read -p "Please i ...

  9. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 表单

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  10. Vue 中引入echarts

    安装依赖 npm install echarts -S 或者使用淘宝的镜像 npm install -g cnpm --registry=https://registry.npm.taobao.org ...