Reputation: 6697
Hello I have a jquery ajax call that returns json data from an api.
I turned that json into a variable and want to use it in d3.json
.
It isnt taking the variable name, I think because its expecting a url instead of a variable name.
Here is the code:
jQuery.ajax({
type: "GET",
url: myurl.com,
success: function(effects)
{
var dataArray = effects;
d3.json(dataArray, function (data) { //error here
console.log(data);
});
}
});
Those of you good with d3, can you help me get the json data into the d3.json
function?
Thanks
Upvotes: 1
Views: 384
Reputation: 19
I think you've got the data from API which you called effects. I suppose that the effects are in json format like "key":"value" paires, you can try var jsonVariable = effects["key"] to get the value.
Upvotes: 1