點擊登錄按鈕,用post方法成功獲取到token后,怎么轉到登陸界面
<form id="register" action="http://localhost:8000/api-token-auth/" method="post">
? ? ? ? ? <h2>歡迎登錄</h2>
? ? ? ? ? <label for="name">Username</label><input type="text" id="name" name="name" />
? ? ? ? ? <label for="pwd">Password</label><input type="password" id="pwd" name="pwd" />
? ? ? ? ? <button onclick="login();return false">登錄</button>
</form>
<script type="text/javascript">
function login(){
$.post("http://localhost:8000/api-token-auth/",{username: $("#name").val(),password: $("#pwd").val(),},?
function(result) {console.log(result)})
}
</script>
2019-08-10
重定向