state_by_date CORS

by nrenner

JavaScript

// augmented_state_by_date CORS
// Origin is not allowed by Access-Control-Allow-Origin.

function log(msg) {
    document.body.innerHTML += msg + '<br/>';
}

function get(url) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.onload = function(evt) {
        log('length: ' + xhr.responseText.length + ', responseText: "' + xhr.responseText + '"');
    };
    xhr.onerror = function(evt) {
        log('ERROR: ' + xhr.status + ' ' + xhr.statusText + ' (see JavaScript Console on Chrome)');
    };
    xhr.send();
}

var osmBase = new Date().toISOString().substr(0, 19).replace(/:/g, '\\:') + 'Z';
get('http://overpass-api.de/api/augmented_state_by_date?osm_base=' + osmBase);