注册

$(function(){

        $('#_js_loginBtn').on('click',function(e){

            var phone=$('#inputPassword').val().trim();

            if(phone.length===0){

                alert(手机号错了);  return; }

            $.ajax({

                url:'检查手机号是否注册',  data:{phone:phone},

                success:func(res){

                    if(res.data){

                        $('.signup-box').fadeIn(300).prev().hide();

                    }else{

                        location.href="./login.html";

                    }

                }

            })

        })

      //注册页

        $('#editForm button').on('click',function(e){

            e.preventDefault();

            //获取表单四个输入框内容

            var nickname=$('#editForm [name=nickname]').val().trim();

            pswd    rpswd    verifyCode 同理

            // 再获取一次手机号

            var phone=$('#inputPassword').val().trim();

            if(p!==rp){ alert('两次密码不一致');  return;}

            //发送请求

            $.ajax({ url:‘ 用户注册 ’, type:'post ',  data:{长:短n  pa  rps  vC  ph },

                success:function(res){

                    if(res.msg='操作成功'){

                        location.href="login.html";  }else{

                        alert(res.msg);

                    }

                }

            })

        })

      })

你可能感兴趣的:(注册)