This issue bugged me for days. After a deep inspect of jQuery source code, I worked out this code:
$url="../status.php";
$.ajax({
"url":$url,
"type":"GET",
"complete":function(xhr, s){
handleResponse(xhr, s);
}
});
function handleResponse(xhr, status){
$("#result").append("
Headers:
"+xhr.getAllResponseHeaders());
var $dateStr = xhr.getResponseHeader("Date");
alert(xhr.responseText);
alert($dateStr);
var $date = new Date($dateStr);
alert($date);
}
<div id="result"></div>
===================
If you think this is useful, please leave a word, many thanks.
没有评论:
发表评论