Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // By default fetch use GET method
- fetch('<url_to_call>')
- .then(response => {
- if (response.state === 200) {
- response.json().then(data => {
- console.log(data);
- });
- } else {
- console.log('Server response error code');
- }
- })
- .catch(err => {
- console.error(err);
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement