• 警告

  • 原因

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. PPT页面切换动画

    想要自己的PPT更加炫酷一些的话,可以再给每个页面的切换,加上动画效果. 第一步,按住ctrl键,鼠标点击选择想要增加切换动画的页面,然后点击菜单栏的“切换” 第二步,在切换菜单下面选择具体的切换效果 ...

  2. Java 自定义DateUtils

    1 /* Date d = new Date(); String s = DateUtils.DateToString(d, "yyyy-MM-dd HH:mm:ss"); Sys ...

  3. 微信小程序引用外部js,引用外部样式,引用公共页面模板

    https://blog.csdn.net/smartsmile2012/article/details/83414642 ================小程序引用外部js============= ...

  4. Codeforces Round #620 (Div. 2) 题解

    A. Two Rabbits 思路: 很明显,如果(y-x)%(a+b)==0的话ans=(y-x)/(a+b),否则就为-1 #include<iostream> #include< ...

  5. 「AT2021」キャンディーとN人の子供 / Children and Candies

    前言 今天练习赛出了这道题,由于我太菜没有在考场上做出来. 翻了题解后,感觉题解讲的并不是十分直观,所以自己写一篇. 题目大意 太长了,不讲了. 数据范围: \(1\leq N\leq 400\) \ ...

  6. Eclipse之Cannot open Eclipse Marketplace

    今天给eclipse安装插件的时候出现各种cannot connect to...的问题, 想打开eclipse marketplace来安装插件出现Cannot open Eclipse Marke ...

  7. python 网络爬虫(三)

    一.网站地图爬虫 在一个简单的爬虫中,我们将使用实例网站 robots.txt 文件中发现的网站地图来下载所有网站,为了解析网站地图,我们将会使用一个简单的正则表达式,从<loc>标签中提 ...

  8. redis之Set(无序)类型常用方法总结

    redis之Set(无序)类型常用方法总结 存--sadd key member [member ...] 取--SMEMBERS key sadd key member [member ...] 向 ...

  9. Acwing779 最长公共字符串后缀

    题目大意:给定n个字符串,让你找到他们的最长公共字符串后缀是什么,可能为空. 分析:题目数据范围比较小,可以O(n*n)暴力匹配,即可解决这道问题.之所以写这道题的题解还是因为写字符串的题还不够多啊, ...

  10. 微软结合Veritas,使用Azure云中的混合存储

    导读 在与Symantec(Symantec)脱离10年(通常令人不愉快的关系)一周年之际,Veritas Technologies在2月22日宣布与Microsoft Corp. 建立了多年战略全球 ...