Skip to content

Instantly share code, notes, and snippets.

@jvadillo
Created August 2, 2017 07:23
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 jvadillo/ba86b8180f959329cfbe0885f261a901 to your computer and use it in GitHub Desktop.
Save jvadillo/ba86b8180f959329cfbe0885f261a901 to your computer and use it in GitHub Desktop.
How to use fetch-jsonp library
import fetchJsonp from 'fetch-jsonp';
function handleSearch(user){
//let url = 'https://api.github.com/users/'+user+'/repos';
const token = '304163526.e0b4176.e924858e024645989aae580c6523aee0';
let url = 'https://api.instagram.com/v1/tags/akebaso/media/recent?access_token=304163526.e0b4176.e924858e024645989aae580c6523aee0';
fetchJsonp(url, {
method: 'GET',
mode: 'no-cors',
credentials: 'include',
})
.then(response => response.json())
.then(response => {});
/*fetch(url,{'mode': 'no-cors'}).
then(response => response.json()).then((repos) => {
console.log(repos);
console.log(repos.length);
});*/
}
handleSearch("jvadillo");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment