I want to add a button at my webpage, when I click the button it will try to locate goo.gl and input the current url.
How could I use goo.gl service by javascript?
FYI:
I found somthing at here http://www.labnol.org/internet/create-google-short-url/11748/ but how to import this function? var auth_token = getUrlShorteningRequestParams(url);
function shortify(url)
{
var auth_token = getUrlShorteningRequestParams(url);
var urlEscaped = escape(url).replace(/\+/g,"%2B");
xmlhttp.open("POST", "http://goo.gl/api/url?
[email protected]&url=" + urlEscaped
+ "&auth_token=" + auth_token, false);
xmlhttp.onload = xmlhttpLoad;
xmlhttp.send(null);
}