Click here to Skip to main content
15,907,236 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionDisplaying specific data from a CSV file Pin
Emre Testici25-Nov-15 21:44
Emre Testici25-Nov-15 21:44 
I want to display specific fields from an external CSV file on a web site with using JavaScript. I tried to parse that file with using "Papa parse" like this: JSBin Link


HTML
<!DOCTYPE html>
<html >
  <head>
    <meta charset="UTF-8">
    <title>Parse remote CSV to HTML Page</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <script src='http://d3js.org/d3.v3.min.js'></script>
	<script src='https://code.jquery.com/jquery-2.1.4.min.js'></script>
	<script src='https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.2/papaparse.min.js'></script>
	<script src='https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.0/mustache.min.js'></script>
	
	<script>
	Papa.parse("https://dl.dropboxusercontent.com/s/wsnizh4lyugxd60/data.csv", {
	download: true,
	header: true,
	complete: function(results) {
	console.log(results);
	
	var data = results.data;
	var arrayLength = data.length;
	for (var i = 0; i < arrayLength; i++) {
    var newdiv = document.createElement('div');

    newdiv.setAttribute('id', 'csvdata'+i.toString());

    newdiv.innerHTML = 'Battery Level: '+data[i].batteryLevel.toString();
}
	
	}
});
	</script>
	
  </body>
</html>



How can I display a specific data from this data set in a web site like:

Battery Level: 0.62

Altimeter Pressure: 99.44185

Horizontal Accuracy: 65

Can you give me an example in JSBin or JSfiddle?
QuestionThe problem of JavaScript position Pin
Ted.K-121-Nov-15 21:28
Ted.K-121-Nov-15 21:28 
AnswerRe: The problem of JavaScript position Pin
Peter Leow21-Nov-15 21:55
professionalPeter Leow21-Nov-15 21:55 
AnswerRe: The problem of JavaScript position Pin
Cai Yang17-Dec-15 23:42
Cai Yang17-Dec-15 23:42 
Questionsocial media buttons block page on IE? Pin
V.17-Nov-15 21:18
professionalV.17-Nov-15 21:18 
QuestionHow to create a number field site column in javascript Pin
Member 1188942312-Nov-15 19:54
Member 1188942312-Nov-15 19:54 
QuestionRe: How to create a number field site column in javascript Pin
ZurdoDev23-Nov-15 3:03
professionalZurdoDev23-Nov-15 3:03 
Questionregex, get the last dollar amount if 2 are present Pin
jkirkerx12-Nov-15 8:51
professionaljkirkerx12-Nov-15 8:51 
AnswerRe: regex, get the last dollar amount if 2 are present [Solved] Pin
jkirkerx12-Nov-15 9:35
professionaljkirkerx12-Nov-15 9:35 
QuestionJavaScript Tour guide Pin
Member 1198488311-Nov-15 21:14
Member 1198488311-Nov-15 21:14 
AnswerRe: JavaScript Tour guide Pin
Richard MacCutchan11-Nov-15 21:19
mveRichard MacCutchan11-Nov-15 21:19 
GeneralRe: JavaScript Tour guide Pin
Member 1198488311-Nov-15 21:33
Member 1198488311-Nov-15 21:33 
AnswerRe: JavaScript Tour guide Pin
Richard Deeming12-Nov-15 2:13
mveRichard Deeming12-Nov-15 2:13 
QuestionJava 2D Array - User Input Pin
Frankie124510-Nov-15 13:02
Frankie124510-Nov-15 13:02 
QuestionRe: Java 2D Array - User Input Pin
Richard MacCutchan10-Nov-15 23:09
mveRichard MacCutchan10-Nov-15 23:09 
QuestionHow can I collect news from differnt sites in one html page Pin
abo sohaib9-Nov-15 20:18
abo sohaib9-Nov-15 20:18 
AnswerRe: How can I collect news from differnt sites in one html page Pin
Afzaal Ahmad Zeeshan9-Nov-15 20:34
professionalAfzaal Ahmad Zeeshan9-Nov-15 20:34 
GeneralRe: How can I collect news from differnt sites in one html page Pin
abo sohaib10-Nov-15 10:36
abo sohaib10-Nov-15 10:36 
QuestionImage does not display in Firefox Pin
ParthiR5-Nov-15 0:57
professionalParthiR5-Nov-15 0:57 
AnswerRe: Image does not display in Firefox Pin
Afzaal Ahmad Zeeshan9-Nov-15 20:39
professionalAfzaal Ahmad Zeeshan9-Nov-15 20:39 
GeneralRe: Image does not display in Firefox Pin
ParthiR11-Nov-15 19:10
professionalParthiR11-Nov-15 19:10 
Questionform question Pin
Member 1197204322-Oct-15 17:43
Member 1197204322-Oct-15 17:43 
AnswerRe: form question Pin
W Balboos, GHB27-Oct-15 8:16
W Balboos, GHB27-Oct-15 8:16 
GeneralRe: form question Pin
Member 1197204327-Oct-15 9:24
Member 1197204327-Oct-15 9:24 
PraiseRe: form question Pin
Richard Deeming28-Oct-15 3:34
mveRichard Deeming28-Oct-15 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.