当http状态301/302在xhr请求时读取位置标题

时间:2011-11-05 14:06:26

标签: javascript jquery ajax xmlhttprequest

您好我只是向页面发送POST请求

var url4 = 'connect.php';
var params4 = 'app_id='+appid[i];
var token = Math['round'](new Date()['getTime']() / 1000);
var http4 = new XMLHttpRequest();
http4['open']('POST', url4, true);
http4['setRequestHeader']('Content-type', 'application/x-www-form-urlencoded');
http4['setRequestHeader']('Content-length', params4['length']);
http4['setRequestHeader']('Connection', 'close');
http4['onreadystatechange'] = function () {
    if (http4['readyState'] == 4 && http4['status'] == 200) {
        http4['close'];
//alert(http4.responseText);
    };
};
http4['send'](params4);
}

我得到这样的回应:

响应:

HTTP/1.1 302 Found
Cache-Control: private, no-cache, no-store, must-revalidate
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Location: newpage?=3b26874b6ef331fa8a688b87e8414116
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Date: Sat, 05 Nov 2011 13:27:46 GMT
Content-Length: 0

我无法通过http4.getResponseHeader(“Location”)读取Location标题; 或者我无法了解我导航到哪里?无论如何

0 个答案:

没有答案