Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. // By default fetch use GET method
  2. fetch('<url_to_call>')
  3. .then(response => {
  4. if (response.state === 200) {
  5. response.json().then(data => {
  6. console.log(data);
  7. });
  8. } else {
  9. console.log('Server response error code');
  10. }
  11. })
  12. .catch(err => {
  13. console.error(err);
  14. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement