Created
January 16, 2014 04:00
-
-
Save vgmoose/8449580 to your computer and use it in GitHub Desktop.
shorten a given URL using goog.gl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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