-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_data.js
23 lines (20 loc) · 959 Bytes
/
load_data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var url="https://docs.google.com/spreadsheets/d/1OQn4DmL6pa-DbMTHjzwXOkDoTgb0-x3lUMv8Z_PuYQ4/gviz/tq";
var jsonData; // save data for next script
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState === 4 && xmlhttp.status===200){
jsonData = xmlhttp.responseText;
create(); // we have the data so we can create the map
}
};
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
// add to the document the script that creates the map
function create() {
var newScript = document.createElement('script');
newScript.setAttribute('type', 'text/javascript');
newScript.setAttribute('src', 'https://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=AvBiDn5MrB3LBYSYeO65dHXFuOO69QAw82FEXcQh6N5x-QwKdN1plg6kPxpmwV1a');
newScript.setAttribute('async', ""); // means async true
newScript.setAttribute('defer', ""); // means defer true
document.body.appendChild(newScript);
}