• 警告

  • 原因

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. Maven 项目中使用 logback

    添加依赖 <dependency> <groupId>net.logstash.logback</groupId> <artifactId>logsta ...

  2. java记录1--接口

    接口(interface)定义:抽象方法和常量值的集合.本质上讲,接口是一种特殊的抽象类 ps:1.接口中定义的属性必须是public static final 的,定义的方法必须是public ab ...

  3. Codeforces Round #551 (Div. 2)D(树形DP)

    #define HAVE_STRUCT_TIMESPEC#include <bits/stdc++.h>using namespace std;int val[300007],num[30 ...

  4. Thymeleaf基本知识(推荐)

    原文: http://blog.csdn.net/pdw2009/article/details/44700897 Thymeleaf是个XML/XHTML/HTML5模板引擎,可以用于Web与非We ...

  5. 使用 C++ 处理 JSON 数据交换格式

    一.摘要 JSON 的全称为:JavaScript Object Notation,顾名思义,JSON 是用于标记 Javascript 对象的,JSON 官方的解释为:JSON 是一种轻量级的数据传 ...

  6. C++ list结构体变量排序

    以下内容是自己整理的根据结构体里面的不同变量,对list排序的实例,若有问题可以留言.仅供参考. #include <iostream> #include <list> #in ...

  7. sql数据库的基本操作

    命令行 1.显示当前数据库服务器中的数据库列表:mysql> SHOW DATABASES;2.建立数据库:mysql> CREATE DATABASE 库名;3.建立数据表:mysql& ...

  8. PHP常用的一些优化技巧

    PHP常用的一些优化技巧 点击联系老杨 ecshop模板 php 优化技巧 老杨ecshop ecshop二次开发 2013-03-29 0 做为最流行的WEB语言, PHP他的突出优势就是其速度与效 ...

  9. 对简易网页版注册系统的制作(连接MySQL数据库)

    一.基本需求 二.设计思路: 1.首先创建一个与数据库数据属性对应的类User,并添加get和set方法. 2.之后建立另一个类UserDao用于生成一条完整的数据对象. 3.再建立一个类DButil ...

  10. SpringTest

    Spring Test 1.对junit的一个扩展   必须先导入junit jar包 2.简化获取bean的步骤 它的底层也是IOC容器 3.IOC的全部 junit的全部  junit的版本必须是 ...