php - Using the jQuery validate plugin with the "remote" option -
i using jquery validate plugin , remote option checking existence of username input field. use code:
remote : { url :'ajax_php/admin/checking.php', type :'post', data : { type:'username' }}
i've noticed request url has callback parameter appended, though set type request post
:
http://localhost/lopoli2/ajax_php/admin/checking.php?callback=jquery15104128487491980195_1311232389069
my php script works fine , returns true
valid username , string invalid usernames. no error message appears! php file in short looks this:
$check = mysql_query("select `username` `user_tbl` `username`='".$_post['username']."' ",$conn) or die('error in db !'); if (mysql_num_rows($check)>0){ echo("username exists"); }else{ echo("true"); }
here's want know:
- what callback parameter for?
- how solve "display error message" problem?
try changing:
echo("username exists");
to
echo("false");
Comments
Post a Comment