I have a JSON data that is found on my URL:
and i'm trying to use it using d3.json() for my charts but it won't return anything. below is my code:
var defaultHighAvailStaticUrl = "/highAvailabilities/" + defaultDate;
console.log(defaultHighAvailStaticUrl);
d3.json(defaultHighAvailStaticUrl, function(error, data) {
if (error) throw error;
console.log(data);
})
I don't know what is wrong. Also is it more easier if I use ajax instead? Since it's a lot more clearer to use i think but i don't know how to call the data in the d3.js chart functions especially on the .data()
of d3. Do i need to use the $.each or should i just shoot on the d3.js codes?
Ajax code i'm planning to use:
$(document).ready(() => {
$.ajax({
url: (defaultHighAvailStaticUrl ),
method: "GET",
dataType: "json",
success: (data) => {
$.each(data, (key, val) => {
});
}
})
});