Home  >  Article  >  Web Front-end  >  AJAX implements the function of detecting user names without refreshing

AJAX implements the function of detecting user names without refreshing

亚连
亚连Original
2018-05-22 11:58:551524browse

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:

The problem of passing array parameters by calling webservice through ajax in jQuery (graphic tutorial)

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn