You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
951 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
{% csrf_token %}
{% load static%}
<script src={% static '/plugins/jquery-3.7.0.js' %}></script>
<body>
用户名:<input type="text" id="username">
密码: <input type="password" id="password">
<button type="submit" id="submit">提交</button>
</body>
<script>
$("#submit").click(function() {
$.ajax({
url: "/logindata/",
type: "POST",
data: {
username: $("#username").val(),
password: $("#password").val(),
"csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val()
},
success: function (data) {
console.log(data);
alert(data.msg);
},
error: function (jqXHR, textStatus, err) {
console.log(arguments)
},
})
})
</script>
</html>