国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > AJAX > 正文

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

2024-09-01 08:33:12
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
ajax接收Date類型的數(shù)據(jù)時(shí)將會(huì)把數(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();
}


控制臺(tái)輸出:

1400032471285 from $.get()
1400032471294 from xhr

By the way:

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

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 柳江县| 云阳县| 资阳市| 姜堰市| 固始县| 屏东县| 恩施市| 内黄县| 道真| 徐闻县| 宁河县| 望谟县| 新绛县| 泗洪县| 辽宁省| 津南区| 台南县| 遂川县| 介休市| 独山县| 伊春市| 阳泉市| 泽普县| 上高县| 峨眉山市| 修水县| 丽江市| 固镇县| 渝中区| 兴化市| 衡阳县| 类乌齐县| 锡林浩特市| 鄂州市| 灵川县| 青田县| 福泉市| 离岛区| 岳池县| 两当县| 屯留县|