-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
28 lines (23 loc) · 826 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
request = new XMLHttpRequest();
request.open('GET', 'README.md', true);
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
// Success!
var content = document.getElementById('content');
content.innerHTML = (marked(request.responseText));
content.style.display = 'block'
} else {
// We reached our target server, but it returned an error
displayError('Whoops! We said hi to the server, but it didn\'t say hi back.');
}
};
request.onerror = function () {
// There was a connection error of some sort
displayError('Whoops! We couldn\'t get ahold of the server.');
};
function displayError(msg) {
var errorElement = document.getElementById('error');
errorElement.style.display = 'block'
errorElement.innerHTML = msg;
}
request.send();