What errors do you get in your inspector/console?
And it would appear your have totally misconstrued the XMLHttpRequest
https://javascript.info/xmlhttprequest
You probably want something more like
<script>
window.onload = function() {
let xhr = new XMLHttpRequest();
xhr.open('GET', 'https://api.twitch.tv/helix/streams?user_login=dakotaz');
xhr.setRequestHeader("Client-ID", "my 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]) {
//live
} else {
//not live
}
}
}
}
</script>