jQuery实现enter键登录

在登录时,使用快捷键登录时常用的方法,其中

loginReq()方法为请求登录检索的方法
 $("#login").click(function(){
                loginReq();
        });
        $(document).keydown(function(){
                if (event.keyCode == 13) {//回车键的键值为13 
                        console.log(111);
                        loginReq();;
                 }
        });
function loginReq(){//登录请求的方法
var aa = $('.ww’).val();
$.ajax({
  url:"",
  type:"post",
  data:{parm:userName,pwd:pwd},
  success:function(res){
      console.log(res);  
    }        
})

}