[英]send login request to server using jquery POST method
我想登录这个网站: 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>
尝试添加阻止默认值。
$("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");
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.