问答详情
源自:5-2 项目:实现登录和注册

表单提交时,只提交了密码,而没有提交用户名是怎么回事呢?

http://img.mukewang.com/5e5dfb8a0001358902470131.jpg

HTML文件中相关代码

http://img1.mukewang.com/5e5dfbe40001b04504000091.jpg

<script>

            $('#login').click(function(){

                $.ajax({

                    url:"/login",

                    data:{

                        username:$('#username').val(),

                        password:$('#password').val()

                    },

                    dataType:"json",

                    success(res){

                        if(res.err){

                        alert(res.msg)

                        }else{

                            alert("登陆成功")

                       }

                    }

                })

            })

        </script>


提问者:Alittermanner 2020-03-03 14:40

个回答

  • Alittermanner
    2020-03-03 15:05:05

    解决了,username拼写错误?