Home >Web Front-end >JS Tutorial >What does fetch mean?
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.
#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
nowThe above is the detailed content of What does fetch mean?. For more information, please follow other related articles on the PHP Chinese website!