AJAX异步验证密码

$(function() {
    $("#usercode").blur(function () {
        var pwd = $(this).val();
        var Y = "<img src='http://localhost:8080/dome_war/images/y.png' width='18px' height='18'>";
        var X = "<img src='http://localhost:8080/dome_war/images/n.png' width='18px' height='18px'>用户名已存在";
        $.post("http://localhost:8080/dome_war/uppwd.du", {"userid": "adduserajax", "usercode": pwd}, function (result) {
            if (result.oldpwd == 0) {
                $("#usercode").next().html(Y);
                $("#a1").val(1);
            }
            if (result.oldpwd == 1) {
                $("#usercode").next().html(X);
                $("#a1").val(0);
            }
        }, "json");
    })

 

posted @ 2021-10-05 18:58  A~你说啥?我听不见!  阅读(40)  评论(0)    收藏  举报