0

I am a very new programmer and struggling to even know what I am doing wrong. I am trying to load and read a CSV file into an html file, and open my web server to check if the CSV is loading into the console.

I have tried creating a local web server - not even sure if I did that correctly.

Here is the index.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Ass 3</title>
        <link rel="stylesheet" type="text/css" href="style.css" >
        <script src="https://d3js.org/d3.v7.min.js"></script>
        <title>Title</title>
    </head>
    <body>
        <p>Look at some data</p>

        <script>
            d3.csv("C:/xampp/htdocs/dashboard/countries.csv").then(function(data) {
                console.log(data)
            }).catch(function(error) {
                console.log(error)
            })
        </script>
    </body>
</html>

some-file.js:

d3.csv("C:/xampp/htdocs/dashboard/countries.csv").then(function(data) {
    console.log(data[0]);
});
LazyOne
  • 158,824
  • 45
  • 388
  • 391
Just
  • 1

0 Answers0