typecho ajax登陆

typecho ajax登陆 反回responseText返回的为html代码!
帐户密码为admin/123456
<script>

              $.ajax({

   url: "<?php $this->options->loginAction(); ?>",
   data:{'name':'admin','password':'123456'},
   type: "POST",
   dataType:'json',
   success:function(data){

                     $('#errormsg').html("2");
                     console.log(data);
                }, 
                error : function(data) {
                    $('#errormsg').html("1");
                    console.log(data);
                }
            });
            

</script>
返回的:
readyState:4
status:200
statusText:parsererror
responseText:html代码
一直是error:function(data)
怎么解决

阅读 3k
2 个回答
新手上路,请多包涵

高手帮助解答

不知道楼主解决没,如果解决了,方法能否分享下!
我其实用了个比较蠢的方法解决了这个问题,就是判断responseText返回的东西,未登录页面和登录页面返回的responseText有部分地方是不一样的(看自己的模板),比如我的模板有个登录按钮,如果登录成功这个登录按钮就不显示了,然后判断responseText里面¥是否有这个按钮就可以判断是否登录成功!

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题