10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 11:17:42 +02:00
QUESTDB_website/scripts/data.js

22 lines
551 B
JavaScript

function getDataFromFile(file,fn) {
var result = null;
var xmlhttp = new XMLHttpRequest();
xmlhttp
xmlhttp.open("GET",getFullDataPath(file), true);
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {//when a good response is given do this
var data = JSON.parse(this.responseText); // convert the response to a json object
fn(data)
}
}
xmlhttp.send();
}
function getDoiUrl(doi) {
return 'https://doi.org/'+doi
}
function getFullDataPath(path) {
return 'data/'+path
}