Sourabh Dhiman

Sourabh Dhiman

  • 1.6k
  • 290
  • 8.4k

Long url To Short Url.

Nov 17 2019 1:06 AM
$(document).ready(function () {
var login = "o_6m51q5m49v";
var api_key = "88b9679a15d63f8a096be28e37461a9b872073f1";
var long_url = "https://twitter.com/about/resources/buttons#tweet";
get_short_url(long_url, login, api_key, function(short_url) {
console.log(short_url);
});
function get_short_url(long_url, login, api_key, func)
{
$.getJSON(
"http://api.bitly.com/v3/shorten?callback=?",
{
"format": "json",
"apiKey": api_key,
"login": login,
"longUrl": long_url
},
function(response)
{
func(response.data.url);
}
);
}
});
 
Please check this code . i will check this code output in console . Undefine output . Please check this what's problem here 

Answers (2)