if (xhr.status === 200) {
alert(xhr.responseText+document.getElementById("thatid").value);
document.getElementById("thatid").value = xhr.responseText;
//document.getElementById("f3").value = 'yayayay';
}
<form>
<button id="thatbtn" value="submit" >
<input type="hidden" id="thatid" value="bob" >
</form>
basically the alert works and prints xhr.responsetext, but it does not change the 'thatid' input on form
<div id="f5" style="display:none;"></div>
xhr.onload = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
dude = xhr.responseText;
f5.innerHTML = dude;
alert(dude+f5.innerHTML);
//this does change the innerHTML
//however, trying to read f5.innerHTML outside of onload
//function will read '' or none, y not persistent?
}
else if (xhr.status !== 200) {
alert('Request failed. Returned status of ' + xhr.status);
}
};
alert(f5.innerHTML); //yields no text