Return to Snippet

Revision: 24640
at March 7, 2010 06:15 by stephanepericat


Initial Code
/**
 * author : Stephane P. Pericat
 * date : 2010-03-02
 */

var link = "http://www.snipplr.com/";
var slink = null;

var short = new Request.JSONP({
    url: 'http://api.bit.ly/shorten',
    callbackKey: 'callback',
                    
    onSuccess: function (result) {
        slink = result['results'][''+link+'']['shortUrl'];
        console.log(slink)
    },
    data: {
        version: '2.0.1',
        longUrl: link,
        login: 'username',
        apiKey: 'R_dd761983d39ab216af226a19756496d3',
        format: 'json'
    }
}).send();

Initial URL

                                

Initial Description
A simple way to send an ajax request to the Bit.ly API and return the shortened url.

Initial Title
Connect to Bit.ly API  with MooTools

Initial Tags

                                

Initial Language
JavaScript