My question is to fill an arrary with data from an ajax request. My ajax call receives the data fine and is logged n the console. What I'm having difficulty with is filling my array with that data. Here is my code.
$.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
Just use JSON.parse() like this:
fipsData = JSON.parse(data);
and you should be good to go.