function unshortBitlyLink (link, callback) { var url = 'https://api-ssl.bitly.com/v3/expand?format=txt&access_token=' + API_TOKENS.BITLY + '&shortUrl=' + link.href;
$.ajax({ url: url, type: 'GET', success: function (actualURL) { setLinkText(link, actualURL); }, complete: function (response) { if (callback) callback(link.href, response); } });}
XMLHttpRequest cannot load https://api-ssl.bitly.com/v3/expand?access_token={removed my token for obvious reasons}&shortUrl=http://bit.ly/2j2A3gS. No 'Access-Control-Allow-Origin' header is present on the requested resource.
var service = "https://api-ssl.bitly.com/v3/expand";
var xhr = new XMLHttpRequest();
xhr.open("POST", service, true);
xhr.withCredentials = true;
var shorturlsquery = "&shorturl=" + shorturls.join("&shorturl=");
params = "login="+user+"&apiKey="+key+shorturlsquery;
xhr.send(params);
xhr.open("GET", service, true);