我要登录此网站:https://kintai.jinjer.biz/sign_in 我使用POST方法将登录凭据发送到网站表单,并请求登录作为响应。 但是,它不起作用。单击按钮后,我将重定向到登录页面。 代码有问题吗?
<html>
<head>
<title> Approach to Login</title>
<script type="text/javascript" src="https://jinji.jinjer.biz/assets/templates/hr/js/jquery.min.js"></script>
<script async="" src="//wap.wovn.io/1.js"></script>
<script>
$(document).ready(function() {
$("button").click(function(){
$.post("https://kintai.jinjer.biz/sign_in",{
company_code:"5709",
email:"1234",
password:"1234"
},function (data) {
window.open("https://kintai.jinjer.biz/staffs/top");
});
});
});
</script>
</head>
<body>
<button type= "submit"> Login </button>
</body>
</html>
答案 0 :(得分:0)
尝试添加阻止默认值。
$("button").click(function (e) {
e.preventDefault();
$.post("https://kintai.jinjer.biz/sign_in",{
company_code:"5709",
email:"1234",
password:"1234"
},function (data) {
window.open("https://kintai.jinjer.biz/staffs/top");
});
});