I am looking to dynamically insert the data entered in a text box labeled 'postcode' into the URL parameters 'VALUE1' and 'VALUE2'. Unfortunately, I lack examples to provide as I am unsure of where to begin.
<input type="text" name="postcode" placeholder="Postcode" ><br>
<button type="button" onclick="loadDoc()">Get Postcode</button>
<p id="Addresses">No Postcode</p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
document.getElementById("Addresses").innerHTML = xhttp.responseText;
}
};
xhttp.open("GET", "https://api.getaddress.io/v2/uk/VALUE1&VALUE2", true);
xhttp.send();
}
</script>
My query is