Ajax verification username example code
Jan 10, 2018 am 09:59 AMThis article mainly introduces the example code of Ajax verification user name. It is very practical and very practical ajax technology. It provides the ajax source code. Friends who are not familiar with ajax verification user name can take a look!
The code to verify the username using Ajax is as follows:
get guestbook/index.php m : index a : verifyUserName username : 要验证的用户名
Return :
{ code : 返回的信息代码 0 = 没有错误,1 = 有错误 message : 返回的信息 具体返回信息 }
js Code:
oUsername1.onblur = function() { //失去焦点的时候,把当前用户名给后端去验证 ajax('get', 'guestbook/index.php', 'm=index&a=verifyUserName&username=' + this.value, function(data) { //alert(data); 浏览器调试查看 var d = JSON.parse(data); //解析 oVerifyUserNameMsg.innerHTML = d.message; //将返回信息展示到页面上 if (d.code) { //code : 返回的信息代码 0 = 没有错误,1 = 有错误 oVerifyUserNameMsg.style.color = 'red'; //错误信息加红色 } else { oVerifyUserNameMsg.style.color = 'green'; //正确信息加绿色 } }); }
I will share with you so much about the ajax verification user name example code, I hope it will be helpful to everyone. !
Related recommendations:
Ajax asynchronous file upload example code sharing
Detailed explanation of Ajax request and Filter cooperation case
Ajax quickly solves the problem that the parameter is too long and cannot be submitted successfully
The above is the detailed content of Ajax verification username example code. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What to do if the blue screen code 0x0000001 occurs

GE universal remote codes program on any device

What does the blue screen code 0x000000d1 represent?

How to solve the 403 error encountered by jQuery AJAX request

How to solve jQuery AJAX request 403 error

How to get variables from PHP method using Ajax?

Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing
