I have the following code which is working correctly.I need to assign a variable to the data returned from the php code.Please help me solve this problem because it is really disturbing me
$(document).ready(function(){
$('#nickname').keyup(function(){
$('#checkUser').show();
var nickname=$(this).val();
if(nickname !=''){
$.post('php/checkUser.php',{nickname:nickname},function(data){
//for example var value=$(this).val(data);
if(data=='false'){
$('#checkUser').html('<img src="images/true.png"   width=15>');
$('#nickname').css('width','382');
} else if(data=='true'){
$('#checkUser').html('<img src="images/false.png"   width=15>');
$('#nickname').css('width','382');
}
});
}else{
$('#nickname').css('width','400');
$('#checkUser').hide();
}
});
});
I just saw your live code and debugged it, Found this issue:
Your php script is returning " false"
instead of "false"
that's why if(data=='false')
is not working
if you add your checkUser.php
code I can help you further...