xmlhttp.status获取200个重定向状态代码

时间:2015-03-24 17:58:15

标签: jquery ajax json tornado

将ajax发送到龙卷风服务器进行重定向并获取200状态代码。 客户端

 $.ajax({
                    type: "POST",
                    url: url,
                    processData: false,
                    contentType: 'application/json',
                    data: data,
                    complete: function (xmlHttp, textStatus) {
                        alert(xmlHttp.status.toString());
                        alert(textStatus);
                        if (xmlHttp.status.toString()[0] == '3') {
                            top.location.href = xmlHttp.getResponseHeader('Location');
                            alert(top.location.href)
                        }
                    }
                });

服务器端

class Login(tornado.web.RequestHandler):
    def post(self):
    print "post"
    print self.request.body
    self.redirect("/")

在chrome浏览器F12网络标记

login            post 302 ...
10.xxx.xxx.xxx   get  304 ...

为什么警报功能显示200状态代码? 感谢

0 个答案:

没有答案