我有一个表单,通过ajax提交。我正在使用jquery表单插件。我的目标是获取从服务器返回的“Location”头信息。我可以在firebug中看到它。但是每当我在成功回调中调用getResponseHeader()函数时,它总是返回“undefined”。
代码:
form.ajaxForm({
dataType: 'xml',
data: {format: 'xml'},
resetForm: true,
success: function(xml,status,xhr){
var location = xhr.getResponseHeader('Location');
alert(location);
});
location未定义。但是我可以在firebug中看到“Location”标头。我缺少什么?即使我从xhr对象调用getAllResponseHeaders(),它也返回“未定义”