$("#login").on("click", function(){ $.ajax({ url: '/login', dataTYpe: 'json', data: { username: $("#username").val(), password: $("#password").val(), }, success: function(res){ console.log(res) console.log(typeof(res)) if(res.status == 1){ Location.href='admin.html' } alert(res.msg) } }) })
你的dataType写错了