2013-03-18 66 views
0

下面是我的jquery ajax調用。我從fire bug看到我得到了json響應。jquery和json ajax ....如何解析數據

Content-Type application/json 
    {x:1363590711.97,y:0.277528026651} 

但是...我不能事件彈出和警報的數據?我如何獲得解析的json對象,以便我可以開始工作了嗎?

$.ajax({ 
     type: 'GET', 
     url: 'ajax_test', 
     crossDomain: false, 
     dataType: 'json', 
     success: function(responseData) { 
      alert(responseData); 
      //seriesJsonData[0]['data'].push({y: responseData.y, x: responseData.x}); 
     } 
}); 
+0

你responseData應該是JSON了,所以responseData.x應1363590711.使用的console.log響應(reponseData)在控制檯中查看對象。 – Kodemon 2013-03-18 07:17:08

+0

alert(responseData.x)/ alert(responseData.y) – 2013-03-18 07:18:09

回答

1

當你請求的dataType你返回數據已經被解析: 'JSON'

$.ajax({ 
    type: 'GET', 
    url: 'ajax_test', 
    crossDomain: false, 
    dataType: 'json', 
    success: function(responseData) { 
      alert(responseData.x + " " + responseData.y); 
      seriesJsonData[0]['data'].push(responseData); 
    } 
});