Home > Web Front-end > JS Tutorial > body text

What does fetch mean?

(*-*)浩
Release: 2019-08-03 10:32:14
Original
13111 people have browsed it

Fetch is called the next generation Ajax technology and uses Promise to process data. It is a concise and clear API, simpler and easier to use than XMLHttpRequest.

What does fetch mean?

#When the page needs to request data from the server, Ajax is basically used. (Recommended learning: web front-end video tutorial)

The essence of Ajax is to use the XMLHttpRequest object to request data, and the XMLHttpRequest object implements the processing of returned data through the event mode.

Similar to XMLHttpRequest, Fetch allows you to make AJAX requests.

The difference is that the Fetch API uses Promise. Promise is one of the officially released ES6 contents, so it is a concise and clear API that is simpler and easier to use than XMLHttpRequest.

Browser support

Fetch is not yet a W3C specification, so the native support rate is not high.

Fortunately, IE8 can be perfectly supported by introducing the following polyfills:

1. Since IE8 is ES3, ES5 polyfills need to be introduced: es5-shim, es5 -sham

2. Introduce the Promise polyfill: es6-promise3. Introduce the fetch detection library: fetch-detector

4. Introduce the fetch polyfill: fetch-ie8

5 . Optional: If you also use jsonp, introduce fetch-jsonp

6. Optional: Enable Babel's runtime mode and use async/await

now

The above is the detailed content of What does fetch mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template