Skip to content

Instantly share code, notes, and snippets.

@javierarques
Last active January 16, 2018 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javierarques/35ac96fbf8bc012eaa1bcc83b5434941 to your computer and use it in GitHub Desktop.
Save javierarques/35ac96fbf8bc012eaa1bcc83b5434941 to your computer and use it in GitHub Desktop.
fetchJsonp example: fetching Flickr feed images
import fetchJsonp from 'fetch-jsonp';
const endpoint =
'http://api.flickr.com/services/feeds/photos_public.gne?format=json&tags=Valencia&tagmode=any';
const result = fetchJsonp(endpoint, {
jsonpCallback: 'jsoncallback',
timeout: 3000
});
result
.then(response => response.json())
.then(json => {
console.log(json);
})
.catch(function(err) {
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment