jQuery的AJAX:头似乎无法正常工作
-
23-09-2019 - |
题
我试图得到一个AJAX请求我通过jquery的
制成的头 $.get(url,
function(response, textStatus, headers ) {
console.log("Response: %o", response);
console.log("TextStatus: %o", textStatus);
console.log("Request: %o", headers);
}
);
这似乎并不然而,应该工作:
的响应,并且textstatus打印,但“标题”对象似乎是未定义的
我只是要检查它是否是我所期望(内容类型=“的excel”,等等),或者如果响应类型是HTML,我可以假设我打电话的页面是一个错误
解决方案
这是因为jQuery.get()回调函数不具有第三个参数。 http://docs.jquery.com/Ajax/jQuery.get#urldatacallbacktype
不隶属于 StackOverflow