• 警告

  • 原因

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. SSH项目Dao层和Service层及Action的重用

    泛型 1.泛型的定义 1.泛型是一种类型    1.关于Type            //是一个标示接口,该标示接口描述的意义是代表所有的类型        public interface Typ ...

  2. 动态代理Cglib

    jar包 <!-- https://mvnrepository.com/artifact/cglib/cglib --><dependency> <groupId> ...

  3. Spring学习(一)

    搭建环境 1.创建普通的Java工程 2.添加相应的jar包,下载链接:https://files.cnblogs.com/files/AmyZheng/lib.rar,此外,为了打印信息,我们还需要 ...

  4. 第5节 Actor实战:1 - 6

    10.3.   Actor实战 10.3.1.    第一个例子 怎么实现actor并发编程: 1.定义一个class或者是object继承Actor特质,注意导包import scala.actor ...

  5. 正确使用 Android 的 Theme 和 Style

    原文:http://www.tuicool.com/articles/ZjEZFj Android 5.0 可以给一个 View 单独设置一个 theme 了,其主要用途就是用在 ToolBar 上, ...

  6. WebVR大潮来袭时,前端开发能做些什么

    WebVR大潮来袭时,前端开发能做些什么?     WebVR即web + VR的体验方式,我们可以戴着头显享受沉浸式的网页,新的API标准让我们可以使用js语言来开发.本文将介绍如何快速开发一个We ...

  7. Linux centosVMware shell中的函数、shell中的数组、

    一.shell中的函数 函数就是把一段代码整理到了一个小单元中,并给这个小单元起一个名字,当用到这段代码时直接调用这个小单元的名字即可. 格式: function _name() { command ...

  8. SRS源码——UDP

    srs_app_server.cpp  int SrsServer::listen() { int ret = ERROR_SUCCESS; if ((ret = listen_rtmp()) != ...

  9. windows下pycharm连接vagrant的python环境

  10. YARN 集群的资源分配

    YARN 集群在分配任务时,存在两种方式 1. DefaultResourceCalculator,只考虑内存(memory),每个 container 的 cpu 资源都分配 1 个. 2. Dom ...