Variable doesn't change in a post AJAX jquery function

时间:2017-08-05 12:24:04

标签: jquery ajax

I am running this bit of code to check if a username is available or not.

It makes the error message appear but it doesn't change the variable

if(document.getElementById('username').value.length > 2) {
	v=$("#username");
	$.post('../action/checkusername.php',{username:v.val().toLowerCase()},function(d){
            if(d=='not-available'){
                iserror = iserror + 1;
                $('#warningbox').fadeIn("slow");    
                $('#usernamewarning2').show(); 
            } 
        });
}

0 个答案:

没有答案