2013-08-02 214 views
0

我的问题是用ajax请求填充数据。我的ajax调用收到的数据正常,并在控制台中记录。我遇到的困难是用这些数据填充我的阵列。这是我的代码。填充数组

 $.ajax({ 
     type: "GET", 
     url: WebRoot + "ws/GIS.asmx/CensusData", 
     data: d, 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     success: function (data) { 
      //loop through the data and pull out the fips codes     
      //alert("success"); 
      fipsData = data; 



      console.log(fipsData); 
     } //ends success function 
    }); //ends ajax call 
+0

想要发布'console.log(fipsData);' – tymeJV

+0

的结果你能显示日志的结果吗?或获取您的JSON的网址? –

+0

console.log(fipsData)为空[],但console.log(数据)返回到我的fips代码和我的金额的数据列 –

回答

0

只需使用JSON.parse()来是这样的:

fipsData = JSON.parse(data); 

,你应该是好去。