我使用jQuery 1.4.2與dataType:'json'進行ajax調用。解析包含日期的JSON數據創建錯誤的日期對象
$.ajax({
url: url_with_json_formated_response,
data: jsonOptions,
dataType: 'json',
error: function(XMLHttpRequest, textStatus, errorThrown){
alert('unable to get data, error:' + textStatus);
},
success: function(data) {
console.log(data);
});
如果我看看xhr響應,我會得到以下結果。
{"events":[{"start":"2010-10-25T10:00:00-07:00","label_color":"","kind":"availability","end":"2010-10-25T20:00:00-07:00","recurrence":"monday","body":"some body text","title":"some title text","id":"1492"}]}
,但JSON對象jQuery的格式,我(的console.log(數據),有錯誤的日期對象是接近1970年,像 週四1970年1月1日23:00:00 GMT + 0200(EET)(粘貼形式Chrome的控制檯)
我想有創造Date對象我。任何線索出毛病了JSON解析?