getJSON not working

javascript

#1

Hi everyone,

right now i am trying to do a simple call using jquery to get the followers counter from one user.

Here is my code:

$.getJSON('https://api.twitter.com/1.1/users/lookup.json?screen_name=polinetmoi&oauth_consumer_key=7tR9MqJfxxxxxxxxxxaQw&oauth_nonce=40f926cf591xxxxxxxa16dd3&oauth_signature=lVdJDkYfxxxx7wUa7%2FI%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1456410275&oauth_token=702xxxxxxxxRSUuO5&oauth_version=1.0',
        function(jsonData)
        {
            console.log(jsonData);
        }
    );

All i get is SyntaxError: JSON.parse and CORS missing.

Wait your response.

Thanks.


#2

Unfortunately using client-side Javascript to access the Twitter API is not that simple, as you’ll need to correctly sign your request and potentially provide a CORS header. You might want to take a look at a library like Codebird.js instead.


#3

Fast reply, thanks


#4