Skip to content

Instantly share code, notes, and snippets.

@vgmoose
Created January 16, 2014 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgmoose/8449580 to your computer and use it in GitHub Desktop.
Save vgmoose/8449580 to your computer and use it in GitHub Desktop.
shorten a given URL using goog.gl
function getShortURL(url)
{
return jQuery.ajax({
'type': 'POST',
'url': "https://www.googleapis.com/urlshortener/v1/url",
'contentType': 'application/json',
'data': JSON.stringify({"longUrl" : url}),
'success': function(data){console.log(data.id)}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment