Create a TinyURL with JQuery and JSONP

jQuery 1.2 introduced JSONP support.JSONP is script tag injection, passing the response from the server in to a user specified function.

function tinyUrl(url,success)
{

var apiLink= ‘http://json-tinyurl.appspot.com/?url=’,
link=apilink+encodeURIComponent(url) + ‘&callback=?’;

$.getJSON(link,function(data){
success && success(data.tinyurl);
});

}

tinyUrl(‘http://httpguru.com/adobe-galla/adobe-flex/downloading-and-installing- flex-sdk-builds-into-flex-builder-3/’,function(tinyurl) {

alert(tinyUrl);

});

Popularity: 16% [?]

About the Author

Vinothbabu has written 24 stories on this site.

In short, my name is Vinoth babu { perra kettala summa authrithala } a UI expert from India, Chennai.

2 Comments on “Create a TinyURL with JQuery and JSONP”

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

Copyright © 2010 HTTPguru. All rights reserved.

Our Partners:
WebHosting Jobs| UI expert | Packet Sniffer  | Mobile Home Refinancing  | Laptop LCD screens | CSS Creator| Exchange Hosting| Compare cable companies| Usa online casino | vps | Coupon Codes