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

2

I have a strange problem and it looks exactly like this:

I am consuming the instagram API and this happens the following thing:

  • The return and display of the network tab of the devtools, but in the request callback, is done with XMLHttpRequest, fetch, jQuery.get, etc ... nothing is shown.
  • In fetch api the following error is shown: TypeError: Failed to fetch

Howtosolvethisproblemwhere,thereturnexistsbutIcannotcatchitintherequestcallback?

Codethatexecutesthecallininstagramapi:

    
asked by anonymous 30.10.2017 / 19:27

1 answer

0

Well, the answer to this problem is this:

If you can not retrieve the data in your request response, try the following code

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

The segreno in this game was the dataType: 'jsonp'

Embrace

    
01.11.2017 / 00:31