Multiple URL shorter using jQuery

JQuery is simply great ! I’ve started learning jQuery just before two days and I’m very much impressed with its functions and simplicity. Especially when the ajax thing comes.

For developing my skills , I just completed making a simple Short URL system. I’ve managed to add five url shorter sites in this script.

This script will shorten the url that the user inputs and output the shortened url. I haven’t added a theme on this but you can add it if you are planning to use it.

Demo : Click here

Download : Click here

Description

This consists of two files, index.html and api.php.

The jQuery part of the code is as follows

[javascript]
$(function() {
$(“#button”).click(function() {
var url = $(“#url”).val() ;
var provider = $(“#provider”).val() ;
args = “url=” + url + “&provider=” + provider ;
$(‘#short’).html(“Please wait..”);

$.ajax({
url: “api.php”,
data: args,
success: function(data) {
$(‘#short’).html(“” + data + ““);
}
});

});

});
[/javascript]

 

Impressed ? Try it and modify it for your use !

Leave a Reply

Your email address will not be published. Required fields are marked *