<!DOCTYPE html>
<html>
<head>
<title>ajax</title>
</head>
<body>
<script src="js/dui.js"></script>
<script>
// 方法一
ajax(‘/‘, function (data, obj) {
alert(obj.getResponseHeader("Date"));
});
// 方法二
var xmlhttp = null;
if (window.ActiveXObject) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
else xmlhttp = new XMLHttpRequest();
xmlhttp.open(‘get‘, "/", false);
xmlhttp.setRequestHeader(‘If-Modified-Since‘, ‘q‘);
xmlhttp.send();
var timestr = xmlhttp.getResponseHeader(‘Date‘);
var date = new Date(timestr);
alert(date);
</script>
</body>
</html>
时间: 2024-10-10 15:31:38