Home > Article > Web Front-end > AJAX implements the function of detecting user names without refreshing
This article mainly introduces the AJAX non-refresh user name detection function in detail, which has certain reference value. Interested friends can refer to it
Let’s take a look at the schematic diagram first
register.php
ajax无刷新检测
发表留言
registerPro1.php
网名不可用 "; // }else{ // $info.=""; // } // echo $info; //③ // $info=""; // if($username=="abc"){ // //这里的$info返回的是一个字串 // $info.='{"res":"不可用","id":"123","age":"5"}'; // }else{ // $info.='{"res":"可用","id":"3","age":"1"}'; // } // echo $info; //③+ $info=""; if($username=="abc"){ //这里的$info返回的是一个字串 $info.='[{"res":"不可用","id":"123","age":"5"},{"res":"abc不可用","id":"3","age":"0"}]'; }else{ $info.='[{"res":"可用","id":"1","age":"15"},{"res":"可用","id":"83","age":"9"}]'; } echo $info; ?> 网名可用
Rendering:
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Using ajax to pass arrays And a detailed explanation of the background receiving method
How to solve the problem of Ajax transmitting data with special characters
The above is the detailed content of AJAX implements the function of detecting user names without refreshing. For more information, please follow other related articles on the PHP Chinese website!