Instagram API returns data on the network but does not return in callback

Asked

Viewed 87 times

2

I’m in a strange trouble and he’s just like that:

I’m consuming the instagram API and it happens this happening the following thing:

  • The return is displayed in the network tab of devtools, but in the callback of the request, be it done with Xmlhttprequest, fetch, jQuery.get, etc.. nothing is shown at all.
  • In fetch api the following error is shown: Typeerror: Failed to fetch

inserir a descrição da imagem aqui

How to solve this problem where, the return exists but I can’t catch it in the request callback?

Code that executes the call in the instagram api:

inserir a descrição da imagem aqui

  • Put the js code where you run the call in the api.

  • I updated the code

1 answer

0


Guys, the answer to this problem is this::

If you are unable to recover the data in the reply of your request, try the following code

$.ajax({
    type: "GET",
    dataType: "jsonp",
    url: querystring, 
    success: function(data) {
        resolve(data)
    }
});

The segreno in this game was dataType: 'jsonp'

Hug

Browser other questions tagged

You are not signed in. Login or sign up in order to post.