-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (23 loc) · 734 Bytes
/
app.js
File metadata and controls
26 lines (23 loc) · 734 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
var createMatrix = function(response){
connections = response.connections;
stations = response.stations;
for (i=0;i<connections.length;i++)
{
temp_souce = getValue(connections[i].source);
temp_destination = getValue(connections[i].destination);
temp_speed = connections[i].speed;
temp_time = connections[i].time;
e_speed[temp_souce][temp_destination] = temp_speed;
e_dist[temp_souce][temp_destination] = temp_time;
}
}
var connections = [];
var stations = [];
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
createMatrix(JSON.parse(this.responseText));
}
};
xhttp.open("GET", "response.json", true);
xhttp.send();