Basically I am trying to get followers count of twitter using username by using this URL
https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=USERNAME
this url gives me json.json file. This file contains all the info like
[{
   "following":false,
   "id":"XXXXXXXXXXX",
   "screen_name":"XXXXXXXXXXXXX",
   "name":"XXXXXX XXXXXXXXX",
   "protected":false,
   "followers_count":10988,
  "formatted_followers_count":"10988 followers",
  "age_gated":false
}]
I am trying this code but not working. Please help.
function readTextFile(file, callback) {
    var rawFile = new XMLHttpRequest();
    rawFile.overrideMimeType("application/json");
    rawFile.open("GET", file, true);
    rawFile.onreadystatechange = function() {
        if (rawFile.readyState === 4 && rawFile.status == "200") {
            callback(rawFile.responseText);
        }
    }
    rawFile.send(null);
}
Usage:
readTextFile("https://cdn.syndication.twimg.com/widgets/followbutton/info.json?screen_names=USERNAME", function(text){
    var data = JSON.parse(text);
    console.log(data);
});
 
    