<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 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                  Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                  Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                  How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                  Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                  Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))

                  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>