I am using jQuery to check username availability when registering on my web application. For some reason, rather then to keep user data in database, I store the registered users's ID and password in a flat file accounts.txt. The format is like this:
joe:frt25t5546g
john:sdfsdgg
Update
Thanks to the help of guys here, I finally got a clue on it, I followed the method on http://roshanbh.com.np/2008/04/check-username-available-ajax-php-jquery.html.
Here is part of my registration.html
$(document).ready(function()
{
$("#uname").blur(function(){
$.post("usernameCheck.php",{user_name:$(this).val()},function(data)
{
if(data=="no"){
$(this).html("This username already exists");
}
else{
$(this).html("Username is available!");
}
});
});
}
<body>
<form name="form" method="post" action="" />
<table>
<tr><td>Username: </td>
<td><input type="text" name="uname" id="uname" /></td></tr>
</table>
<input type="submit" name="submit" value="Register" />
</form>
</body>
I am quite new to jQuery, ajax sort of things...Thanks!
.split()and there is.match()method alsouser_name, and receiving parameteruname, is one thing I can see at a glance.