var textLabel = new Object(); function httpRequest(){ var request = new XMLHttpRequest(); request.onreadystatechange = function(){ if(request.readyState == 4){ if(request.status == 200){ var result = JSON.parse(request.responseText); window.textLabel.nameOne = result.warNameOne; window.textLabel.nameTwo = result.warNameTwo; } } } request.open('GET', 'core.php'); request.send(null); }