$("#login-form").submit(function () {
            $.ajaxSetup({
            data: {csrfmiddlewaretoken: '{{ csrf_token }}'}
            });
            $.ajax({
                type:"POST",
                data:{username:$("#login-username").val(),password:$("#login-password").val()},
                url:"{% url "login" %}",
                dataType:"html",
                success:function (result) {
                    if(result=="false"){
                        $("#login-p").css("color","red").text("username or password error!");
                    }else {
                        window.location.href="{% url "index" %}";
                    }
                }
            });
            return false;
        });

 

 window.location.href="{% url "index" %}";

  

 

相关文章:

  • 2021-10-17
  • 2021-05-08
  • 2021-06-15
  • 2022-12-23
  • 2021-12-07
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2022-01-30
  • 2022-01-29
  • 2022-01-31
  • 2022-01-23
  • 2022-01-06
相关资源
相似解决方案