Merge pull request #56 from timoxley/response-code

Check for 200 response code.
This commit is contained in:
Julien Fontanet 2015-05-27 10:58:38 +02:00
commit ce68c4af2d

View File

@ -29,7 +29,10 @@ function retrieveFile(path) {
var xhr = new XMLHttpRequest();
xhr.open('GET', path, false);
xhr.send(null);
var contents = xhr.readyState === 4 ? xhr.responseText : null;
var contents = null
if (xhr.readyState === 4 && xhr.status === 200) {
contents = xhr.responseText
}
}
// Otherwise, use the filesystem