I would like to import these data file values in an array. so times[0] would be 23,8 etc...
Example data file web.txt (temperature values in C°):
23,8
23,2
22,8
22,0
... etc
The code below is what i have thusfar reading the web.txt file and displaying the values in a browser.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>load demo</title>
<style>
body {
font-size: 16px;
font-family: Arial;
}
</style>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p id="myid"></p>
<script>
var times = [];
$.get('web.txt', function(data) {
//var fileDom = $(data);
var lines = data.split("\n");
$.each(lines, function(n, elem) {
$('#myid').append('<div>' + elem + '</div>');
});
});
</script>
</html>
lines. Why do you need 2 arrays?eachloop oflines