<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="/static/dist/js/jquery-3.1.1.js"></script>
</head>
<body>
<form action="/icbc.html" method="post">
{% csrf_token %}
<input type="text" name="from">
<input type="text" name="to">
<input type="text" name="money">
<input type="submit" value="转账">
<a onclick="ajaxSubmit();">Ajax提交</a>
</form>
<script>
function ajaxSubmit() {
$.ajax({
url: 'icbc.html',
type: 'POST',
data: {'k1': 'v1', 'k2': 'v2', 'csrfmiddlewaretoken': $('input[name="csrfmiddlewaretoken"]').val()},
success: function (arg) {
console.log(arg)
}
})
}
</script>
</body>
</html>
ajax的csrf_token
猜你喜欢
转载自blog.csdn.net/wuxingpu5/article/details/78063047
今日推荐
周排行