欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ajax接收Date類型的數(shù)據(jù)時(shí)會把數(shù)據(jù)轉(zhuǎn)換為時(shí)間戳

 更新時(shí)間:2014年05月18日 17:14:53   作者:  
ajax接收Date類型的數(shù)據(jù)時(shí)將會把數(shù)據(jù)轉(zhuǎn)換為時(shí)間戳,下面是具體的示例,大家可以參考下

復(fù)制代碼 代碼如下:

$("#test").click(function(e) {
$.get(
"/mgr/datacleaning/test",
function(data) {
console.log(data + " from $.get()");
}
);

var xhr = new XMLHttpRequest();
xhr.open("GET", "/mgr/datacleaning/test");
xhr.onreadystatechange= function(e) {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText + " from xhr");
}
};
xhr.send(null);
});

復(fù)制代碼 代碼如下:

@ResponseBody
@RequestMapping(value="/test")
public Date test() {
return new Date();
}

控制臺輸出:

1400032471285 from $.get()
1400032471294 from xhr

By the way:

$.get()的請求頭只比xhr的請求頭多了一個(gè):
X-Requested-With:
XMLHttpRequest

相關(guān)文章

最新評論