forked from danielscarvalho/FTT-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaulajs16.html
More file actions
27 lines (26 loc) · 842 Bytes
/
Copy pathaulajs16.html
File metadata and controls
27 lines (26 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Aula 16</title>
<script>
function loadCsv() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("dados").innerHTML = this.responseText;
document.getElementById("size").innerHTML = document.getElementById("dados").innerHTML.length;
}
};
xhttp.open("GET", "data/FL_insurance_sample.csv", true);
xhttp.send();
}
</script>
</head>
<body>
<h1>JavaScript Aula 16</h1>
<h2>AJAX - Asynchronous JavaScript And XML</h2>
<button onclick="loadCsv()">Ler CSV</button>
<p id="size"></p>
<pre id="dados"></pre>
</body>
</html>