2013-03-18 96 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); 
    } 
});