get response api using vanilajavascript
fetch('https://jsonplaceholder.typicode.com/postses').then(function (response) {
// The API call was successful!
if (response.ok) {
return response.json();
} else {
return Promise.reject(response);
}
}).then(function (data) {
// This is the JSON from our response
console.log(data);
}).catch(function (err) {
// There was an error
console.warn('Something went wrong.', err);
});
Also in JavaScript:
- javascript events
- minify css package.json
- javascript get list of class names
- react redirect after login
- js-cookie
- check if the data can be parsed javascript
- range javascript
- node js http request get parameters
- javascript keypress backspace not working
- jquery focus
- foreach break js
- debugger js
- materal ui react range slider
- check the doc name in javascript
- jQuery Aniview
- jquery find by innertext
- javascript on hover
- how to use componentdidmount in functional component
- javascript execute code on page load
- for in js loop
- what are the uses of babel js
- span role link
- how to compare two strings in javascript if condition
- nangular make window available