Reputation: 278
i am new in D3 JS. I would like to load json data from D3 js. Here, I am not sure if json is loaded. Here, non of message is appear. I want show html and json data ,
mydata.json
[
{"name":"Hira","age":35},
{"name":"Basu","age":26},
{"name":"Mukhia","age":30}
]
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<script src="https://d3js.org/d3.v5.min.js"></script>
</head>
<body>
<script>
d3.json("./mydata.json", function(data) {
console.log(data);
});
</script>
</body>
</html>
Hope if you guys can give some hints.
Upvotes: 1
Views: 245
Reputation: 278
here, I got a solution.
d3.json("./mydata.json").then(function(data){
console.log(data);
});
In new version we have to specify then function . In then function we have to make call back function.
Upvotes: 1