Created
March 31, 2016 03:40
-
-
Save 52cik/3680872ebff0722ceafd321f0795c619 to your computer and use it in GitHub Desktop.
ajax 获取服务器日期
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax('?', {type:'head'}).done(function(data, status, xhr) { | |
var dt = new Date(xhr.getResponseHeader('Date')); // 字符串转日期对象 | |
console.log(dt.toLocaleString()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment