lundi 11 juillet 2016

Using jQuery to load a csv file [duplicate]

This question already has an answer here:

I am trying to download from the server (using my local WAMP) a csv file with using the code below and it does not work. I suspect hat I need to use AJAX however I am not familiar with Ajax yet.

The content of the csv file is:

1,2,3 4,5,6 7,8,9

Your help is appreciated. Here is my code:

<script type="text/javascript" src="jquery-2.2.0.min.js"></script>
<script type="text/javascript">

function UpdateFunction() {
$.get('example.csv', function(data){
example_array = data.split();
})
}

UpdateFunction();
alert (example_array);

Aucun commentaire:

Enregistrer un commentaire