Javascript
$.fn.checkAvailability = function() {
$("#check-username").click(function() {
if ( $(#username).attr("value") != ) {
$(.loading).show();
var username = $(#username).val().toLowerCase();
$.get("check-username.php", { username:username } , function(data) {
//if username is already taken (FALSE)
if (data == 0) {
$(.loading).hide();
$(.error).remove();
$(.available).remove();
$(#check-username).after(<span class="error"></span>);
$(.error).text(Username is already taken.);
} else {
$(.loading).hide();
$(.error).remove();
$(.available).remove();
$(#check-username).after(<span class="available"></span>);
$( ispan.available).text(Username is available.);
}
});
}
});
$(document).ready(function() {
$("#registration").checkAvailability();
});
xHTML
<form action="#" method="post" id="registration">
<label for="username">Username</label>
<input type="text" name="username" id="username" maxlength="30" />
<input type="button" value="Check Availability" id="check-username" />
<span class="loading"><img src="images/loading.gif" alt="Loading" /></span>
</form>
CSS
.loading {
display: none;
}
.available {
color: #060;
}
.error {
color: #f00;
}
Backend
In this case, we are using a php script called check-username.php. However, the backend doesn’t have to be in php, it can be in any language .aspx (.NET), .do (Java), .cfm (ColdFusion), etc. The backend script just needs to return either 1 or 0 (True or False). 1 when the username is available and 0 when the username is already taken.
Original Source:http://eisabainyo.net/weblog/2009/05/28/check-username-availability-using-ajax-and-jquery/
Related Stuff
-
MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.
-
Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone
-
TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support
-
ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.
-
Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.
-
Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software
- PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.
