we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "vanilla js send get request"
Julieta
16 May 2016
1fetch('https://jsonplaceholder.typicode.com/posts').then(function (response) {
2	// The API call was successful!
3	return response.json();
4}).then(function (data) {
5	// This is the JSON from our response
6	console.log(data);
7}).catch(function (err) {
8	// There was an error
9	console.warn('Something went wrong.', err);
10});
11
Jonas
17 Feb 2017
1fetch('https://jsonplaceholder.typicode.com/posts').then(function (response) {
2	// The API call was successful!
3	console.log('success!', response);
4}).catch(function (err) {
5	// There was an error
6	console.warn('Something went wrong.', err);
7});
8