javascript - Why is this Bit.Ly script not working? -


I'm trying to use the bit.ly API to automatically shorten URLs for my blog But this code is not working

  & lt; Script & gt; GetShortUrl: function (url, callback) {var url = 'https://api-ssl.bitly.com/v3/shorten?access_token=********************************************************************************** **** & amp; LongUrl = http% 3A% 2F% 2Fwww.techforty.com '; $ .getJSON (url, {}, function (response) {if (callback) callback (response.data.url);}); }, & Lt; / Script & gt;  

Is there a quick and easy way to get short URLs from this script in the input box?

It seems that you are using it in an object. Here is the code

  var app = {getShortUrl: function (url, callback) {$ .getJSON (url, {}, function (feedback) {if (callback) callback (response);} ); }} App.getShortUrl ('https://api-ssl.bitly.com/v3/shorten?access_token=************************************************************************************** **************************************************************************************************** ************ LongUrl = http: //www.techforty.com ', function (response) {$ (' # result '). Html (response.data.url;)) ;  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -