1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Merge 18_shorten_over_https

This commit is contained in:
Rémy HUBSCHER 2013-01-24 09:55:48 +01:00
commit 6fffdc0371
2 changed files with 15 additions and 6 deletions

View File

@ -201,11 +201,20 @@
}, },
/** Get a tinyurl using JSONP */ /** Get a tinyurl using JSONP */
getTinyURL: function (longURL, success) { getTinyURL: function(longURL, success) {
var api = 'http://is.gd/create.php?format=json&url='; $.ajax({
$.getJSON(api + encodeURIComponent(longURL) + '&callback=?', function (data) { url: 'https://www.googleapis.com/urlshortener/v1/url',
success(data.shorturl); type: 'POST',
}); contentType: 'application/json',
data: JSON.stringify({
"longUrl": longURL
}),
processData: false,
dataType: 'json'
}).done(function(data){
console.log(data);
success(data.id);
});
}, },
/** Check for browser support of the named featured. Store the result /** Check for browser support of the named featured. Store the result

File diff suppressed because one or more lines are too long