diff options
-rw-r--r-- | newuser.html | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/newuser.html b/newuser.html index 000976b..e817be5 100644 --- a/newuser.html +++ b/newuser.html @@ -12,10 +12,14 @@ $.post( "https://secure.dev.piny.be/piny-validate", { t: "Username", v: obj.value }, function( data ){ var res = $.parseJSON( data ); - if ( res.ok ) { - $("#username-error").removeClass( "error" ).html( "" ); + if ( res ) { + if ( res.ok ) { + $("#username-error").removeClass( "error" ).html( "" ); + } else { + $("#username-error").addClass( "error" ).html( res.msg ); + }; } else { - $("#username-error").addClass( "error" ).html( res.msg ); + $("#username-error").addClass( "error" ).html( "somehow res is null!" ); }; } ); |