Skip to content

Commit

Permalink
Fixed loadJSON to make sure latest version (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyer9 authored and wchill committed Jul 27, 2016
1 parent f8b5d4b commit 576f926
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,20 +797,15 @@ var mapView = {
}
},
loadJSON: function(path, success, error, successData) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (success)
success(JSON.parse(xhr.responseText.replace(/\bNaN\b/g, 'null')), successData);
} else {
if (error)
error(xhr);
}
$.get({
url: path + "?" + Date.now()
}).done(function(data) {
if(data !== undefined) {
success(data, successData)
} else {
error(data)
}
};
xhr.open('GET', path, true);
xhr.send();
})
},
// Adds events to log panel and if it's closed sends Toast
log: function(log_object) {
Expand Down

0 comments on commit 576f926

Please sign in to comment.