xhr.open('GET', '/sendcommand?cmd=' + cmd, true);
xhr.onload = function() {
if (xhr.status == 200) { //can use this.status instead
xhr.open('GET', '/sendcommand?cmd=' + cmd, true);
xhr.onload = function() {
if (xhr.status == 200) { //can use this.status instead