Domanda

I want to get an Instagram follower list using jQuery, I am using the following code, but it is not working. What should I do?

$.ajax({
    url: "https://api.instagram.com/v1/users/1574083/follows?",
    dataType: 'GET',
    data: { access_token: token },
    success: function (result) {
        alert(result.meta.code);
        alert(result.data.username);
    },
    error: function () {
        alert("error");
    }
});
È stato utile?

Soluzione

Try is like this

$.ajax({
    url: "https://api.instagram.com/v1/users/1574083/follows?",
    type: 'GET', // type instead of dataType
    dataType: 'json', // or jsonp for cross-domain 
    data: {
        access_token: token
    },
    success: function (result) {
        alert(result.meta.code);
        alert(result.data.username);
    },
    error: function () {
        alert("error");
    }
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top