验证用户名

时间:2015-01-31 01:42:44   收藏:0   阅读:159
/*
    验证用户名
    get
        guestbook/index.php
            m : index
            a : verifyUserName
            username : 要验证的用户名
        返回
            {
                code : 返回的信息代码 0 = 没有错误,1 = 有错误
                message : 返回的信息 具体返回信息
            }
    */
    oUsername1.onblur = function() {
        $.ajax({
            url: ‘guestbook/index.php?m=index&a=verifyUserName‘,
            type: ‘GET‘,
            dataType: ‘json‘,
            data: {username: this.value},
        })
        .done(function(data) {
            oVerifyUserNameMsg.innerHTML = data.message;  
            if (data.code) {
                oVerifyUserNameMsg.style.color = ‘red‘;
            } else {
                oVerifyUserNameMsg.style.color = ‘green‘;
            }
        })
        
    }

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!