Update html based on if stream is live

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://api.twitch.tv/helix/streams?user_login=dakotaz', true);
xhr.setRequestHeader("Client-ID", "A Valid Client ID");
xhr.send();
xhr.onload = function() {
    if (xhr.status != 200) {
        console.log('Handle non 200');
    } else {
        var data = JSON.parse(xhr.responseText);
        if (data && data.data[0]) {
            content = '<p>Online</p>'
        } else {
            content = '<p>Offline</p>'
        }
console.log(content);
    }
}

Works for me