提交 9c17165b 编写于 作者: D David Graham

Merge pull request #18 from christianalfoni/master

Add example of success and error handlers
......@@ -112,6 +112,19 @@ fetch('/avatars', {
})
```
### Success and error handlers
```javascript
fetch('/users')
.then(function (response) {
if (response.status >= 200 && response.status < 300) {
return response.json().then(mySuccessHandler);
} else {
return response.json().then(myErrorHandler);
}
}).catch(myErrorHandler);
```
## Browser Support
![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册