最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - ReferenceError: Papa is not defined - Stack Overflow

matteradmin7PV0评论

so I'm trying to setup PapaParser to parse a CSV file onto arrays that I can later use with another script to make graphs. So far I just want to paste the strings from my arrays onto the blank div, so I can see what's going on. I am new to this and have no idea how to import javascript libraries, so I copied the files into my public_html folder. Now NetBeans seems to see them.

Long story short I'm stuck at the beginning, I get a reference of ReferenceError: Papa is not defined when I try to run my parser.

Any input or a link to a tutorial on how to do this would be greatly appreciated (tried googling, found nothing of use). I've added my code so far...

Papa.parse("TopPercentilesCSV.csv", {
		plete: function(results) {
			console.log("Finished:", results.data);
		}
	});
.displaypanel {
    border: 1px solid black;
    width:400px;
    height:400px;
    margin:auto;
}
<!DOCTYPE html>

<html>
    <head>
        <title>Parsing CSV test</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link type="text/css" rel="stylesheet" href="index.css"/>
        <script type="text/javascript" src="index.js"></script>
        <script src="PapaParse/papaparse.js"></script>
    </head>
    <body>
        <div class="displaypanel">            
        </div>
    </body>
</html>

so I'm trying to setup PapaParser to parse a CSV file onto arrays that I can later use with another script to make graphs. So far I just want to paste the strings from my arrays onto the blank div, so I can see what's going on. I am new to this and have no idea how to import javascript libraries, so I copied the files into my public_html folder. Now NetBeans seems to see them.

Long story short I'm stuck at the beginning, I get a reference of ReferenceError: Papa is not defined when I try to run my parser.

Any input or a link to a tutorial on how to do this would be greatly appreciated (tried googling, found nothing of use). I've added my code so far...

Papa.parse("TopPercentilesCSV.csv", {
		plete: function(results) {
			console.log("Finished:", results.data);
		}
	});
.displaypanel {
    border: 1px solid black;
    width:400px;
    height:400px;
    margin:auto;
}
<!DOCTYPE html>

<html>
    <head>
        <title>Parsing CSV test</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link type="text/css" rel="stylesheet" href="index.css"/>
        <script type="text/javascript" src="index.js"></script>
        <script src="PapaParse/papaparse.js"></script>
    </head>
    <body>
        <div class="displaypanel">            
        </div>
    </body>
</html>

Share Improve this question asked Dec 30, 2014 at 11:13 Miha ŠušteršičMiha Šušteršič 10.1k27 gold badges97 silver badges175 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

Change your code to this:

<!DOCTYPE html>

<html>
    <head>
        <title>Parsing CSV test</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link type="text/css" rel="stylesheet" href="index.css"/>
        <script src="PapaParse/papaparse.js"></script>
        <script type="text/javascript" src="index.js"></script>

    </head>
    <body>
        <div class="displaypanel">            
        </div>
    </body>
</html>

First you have to include the library, then you can call function defined inside

Post a comment

comment list (0)

  1. No comments so far