Answers for "javascript execute fetch in series"

1

fetch api

// Error handling while fetching API

const url = "http://dummy.restapiexample.com/api/v1/employee/40";
fetch(url) //404 error
     .then( res => {
          if (res.ok) {
                return res.json( );
          } else {
                return Promise.reject(res.status); 
           }
      })
      .then(res => console.log(res))
      .catch(err => console.log('Error with message: ${err}') );
Posted by: Guest on November-27-2020
25

xml http request fetch

fetch('my/url/').then(respone()=>{
		console.log(response);
}
Posted by: Guest on September-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language