HTML:
<input type="hidden" id="someid" name="somename" value="somevalue">
JS:
var hiddenField = document.getElementById('someid');
hiddenField.value = <whatever>;
Вы можете изменить свою функцию на:
function getLocation(locationrouting) {
var getLocation= newXMLHttpRequest(); // sending request
getLocation.open("GET", "/PP?PAGE=GETLOCATIONNAME&ROUTINGNUM=" + locationrouting, false);
getLocation.send(null); // getting location
var dv = document.getElementById("location_div");
var verifyUnfound();
var hiddenField = document.getElementById('someid');
if (getlocation . responseText === 'LOCATION NOT FOUND') {
dv.style.color = "red";
} else {
dv.style.color = "black";
}
dv.innerHTML = getLocation . responseText;
hiddenField.value = getLocation . responseText;
}