Original: Https://hacks.mozilla.org/2015/03/this-api-is-so-fetching
The original title is the This API are so fetching,fetching also can be expressed as charming meaning--translator noteJavaScript executes asynchronous requests through
In Web applications, JavaScript uses XMLHttpRequest (XHR) to execute asynchronous requests. this is a technology that effectively improves page communication. when we talk about Ajax technology, it usually means Ajax based on XMLHttpRequest.
XMLHttpRequest to complete Ajax is a bit old and outdated.
Fetch () enables us to perform AJAX functions similar to those provided by XMLHttpRequest (XHR). The main difference between them is that the Fetch API uses promises, which makes the
First, promise related
Https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise
http://liubin.org/promises-book/#chapter1-what-is-promise
The new Promise (/
* Executor:executor is a function with resolve and
Promise:Before ES6, if we need to do asynchronous processing in JS, most are solved by using callback functions, and if simple asynchronous processing, the callback function looks elegant, the force is still a bit high, but if there are many
As a web development it is necessary to familiarize yourself with the request headers and the response headers of common HTTP. For example, the request header Content-type specified the content of the request, if the type is
React Native uses the sample code of Fetch to send network requests, reactfetch
HTTP requests are usually used in projects to access the network. HTTP (HTTPS) requests are generally divided into "GET", "PUT", "POST", and "DELETE ", if not specified,
Fetch usage and how to receive the value transmitted by JS. fetch receives the value transmitted by js.
Basic fetch method:
fetch('https://mywebsite.com/endpoint/', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type':
In addition to XMLHttpRequest objects to get data in the background, you can use a more optimal solution fetch.Fetch has not been very supportive so far, but it has been supported in Google Chrome. Fetch hangs in the BOM and can be used directly in
Snoopy is a PHP class that mimics the functionality of a Web browser, which accomplishes the task of getting web content and sending forms. Official website http://snoopy.sourceforge.net/
Some features of Snoopy:
Fetching the content of a Web
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.