<tfoot id='Lvfe0'></tfoot>
    1. <i id='Lvfe0'><tr id='Lvfe0'><dt id='Lvfe0'><q id='Lvfe0'><span id='Lvfe0'><b id='Lvfe0'><form id='Lvfe0'><ins id='Lvfe0'></ins><ul id='Lvfe0'></ul><sub id='Lvfe0'></sub></form><legend id='Lvfe0'></legend><bdo id='Lvfe0'><pre id='Lvfe0'><center id='Lvfe0'></center></pre></bdo></b><th id='Lvfe0'></th></span></q></dt></tr></i><div id='Lvfe0'><tfoot id='Lvfe0'></tfoot><dl id='Lvfe0'><fieldset id='Lvfe0'></fieldset></dl></div>

        <legend id='Lvfe0'><style id='Lvfe0'><dir id='Lvfe0'><q id='Lvfe0'></q></dir></style></legend>
      1. <small id='Lvfe0'></small><noframes id='Lvfe0'>

          <bdo id='Lvfe0'></bdo><ul id='Lvfe0'></ul>

        fetch、ajax 和 xhr 之间的区别

        Difference between fetch, ajax, and xhr(fetch、ajax 和 xhr 之间的区别)
      2. <legend id='WlONi'><style id='WlONi'><dir id='WlONi'><q id='WlONi'></q></dir></style></legend>

        <small id='WlONi'></small><noframes id='WlONi'>

          <tbody id='WlONi'></tbody>
              • <bdo id='WlONi'></bdo><ul id='WlONi'></ul>
              • <i id='WlONi'><tr id='WlONi'><dt id='WlONi'><q id='WlONi'><span id='WlONi'><b id='WlONi'><form id='WlONi'><ins id='WlONi'></ins><ul id='WlONi'></ul><sub id='WlONi'></sub></form><legend id='WlONi'></legend><bdo id='WlONi'><pre id='WlONi'><center id='WlONi'></center></pre></bdo></b><th id='WlONi'></th></span></q></dt></tr></i><div id='WlONi'><tfoot id='WlONi'></tfoot><dl id='WlONi'><fieldset id='WlONi'></fieldset></dl></div>

                  <tfoot id='WlONi'></tfoot>
                  本文介绍了fetch、ajax 和 xhr 之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  What is the difference between these 3 calling methods? I'm using fetch in my current project and don't see any real difference between them. Why does there need to be 30 different ways to do things in javascript XD.

                  Thanks.

                  解决方案

                  Ajax is a buzzword meaning "Making an HTTP request from JavaScript without leaving the page".

                  XMLHttpRequest and fetch are APIs, provided by browsers, which allow HTTP requests to be made from JavaScript.


                  XMLHttpRequest has been around since the 90s and is event-driven, requiring that you bind event listeners to detect when data has arrived.

                  fetch is newer and built around Promises, which are now the prefered way to do asynchronous operations in JavaScript. It is sufficiently well established to be supported everywhere significant except in Internet Explorer. It does, however, lack certain features (such as progress monitoring) that `XMLHttpRequest provides.


                  So in short, there are two (not 30) purpose-built ways to do Ajax, and one of them is modern.


                  For practical introductions on how to use either of them, MDN has you covered:

                  • Using XMLHttpRequest
                  • Using Fetch

                  There are also various libraries which wrap around fetch or XMLHttpRequest to provide APIs which are situationally more convenient (e.g. a consistent API between Node.js and browsers or integration with a framework like Angular).

                  这篇关于fetch、ajax 和 xhr 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  首先,我们需要在百度地图开放平台上申请一个开发者账号,并创建一个应用。在创建应用的过程中,我们会得到一个密钥(ak),这是调用API的凭证。 接下来,我们需要准备一个PHP文件,以便可以在网页中调用。首先,我们需要引入百度地图API的JS文件,代码如下
                  ajax请求获取json数据并处理的实例代码 $.ajax({ type: 'GET', url: 'https://localhost:44369/UserInfo/EditUserJson',//请求数据 data: json,//传递数据 //dataType:'json/text',//预计服务器返回的类型 timeout: 3000,//请求超时的时间 //回调函数传参 suc
                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  Rails 3.1 ajax:success handling(Rails 3.1 ajax:成功处理)

                  1. <i id='0LNP6'><tr id='0LNP6'><dt id='0LNP6'><q id='0LNP6'><span id='0LNP6'><b id='0LNP6'><form id='0LNP6'><ins id='0LNP6'></ins><ul id='0LNP6'></ul><sub id='0LNP6'></sub></form><legend id='0LNP6'></legend><bdo id='0LNP6'><pre id='0LNP6'><center id='0LNP6'></center></pre></bdo></b><th id='0LNP6'></th></span></q></dt></tr></i><div id='0LNP6'><tfoot id='0LNP6'></tfoot><dl id='0LNP6'><fieldset id='0LNP6'></fieldset></dl></div>
                    • <bdo id='0LNP6'></bdo><ul id='0LNP6'></ul>

                      <small id='0LNP6'></small><noframes id='0LNP6'>

                        <tbody id='0LNP6'></tbody>

                      • <legend id='0LNP6'><style id='0LNP6'><dir id='0LNP6'><q id='0LNP6'></q></dir></style></legend>

                            <tfoot id='0LNP6'></tfoot>