parent
							
								
									907bdfed12
								
							
						
					
					
						commit
						d9f1e705ac
					
				
				 3 changed files with 51 additions and 0 deletions
			
			
		@ -0,0 +1,35 @@ | 
				
			|||||||
 | 
					<!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> | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue