Hi, I don't understand why I'm not getting the message as "username already exits" if type the username which is already in database.
If the username in a server, then it is returning the value as "1" otherwise empty, and despite of successfully getting the value from the server based on username is present or not, and assigning the value to variable "x", I'm unable to get message when I pass already exist username. May I know?
$(document).ready(pageInit);
function pageInit() {
$('#1').bind('blur',go);
}
function go() {
var value = $('#1').val();
var x = 0;
$.post('just.do',{username:value},function(data){
x = data;
}
);
if(x) {
$('#para').show();
$('#para').html("Username already exits");
return false;
}
else {
$('#para').hide();
return true;
}
};
EDIT: This is what I'm doing in post request in servlets:
String user1 = request.getParameter("username");
if(user != null) {
String query = "Select * from users where user_name="+"\""+user+"\"";
b = db.doExecuteQuery(stmt,query);
if(b) {
out.write("1");
}
}