service_packs.js 588 Bytes
Newer Older
1
document.addEventListener("DOMContentLoaded", function(event) { 
Tam Le's avatar
Tam Le committed
2
	document.getElementById("view-stat").addEventListener("click", function(){
3
  		var xhr = new XMLHttpRequest();
Tam Le's avatar
Tam Le committed
4
  		// replace the link with statistics link
5
6
7
8
9
10
11
12
13
14
  		xhr.open('GET', 'http://localhost:3000/service_packs/1.json');
  		xhr.setRequestHeader('Content-Type', 'application/json');
		xhr.onload = function() {
		    if (xhr.status === 200) {
		        console.log(JSON.parse(xhr.responseText))
		    }
		    else {
		        alert('Request failed.  Returned status of ' + xhr.status);
		    }
		};
Tam Le's avatar
Tam Le committed
15
		xhr.send();
16
17
	});
})