I need to pass a variable called Henry that carries the value '1234' through XMLhttprequest. However, the value on the variable cannot be passed instead the variable name 'Henry' has passed through CGI. So, may I ask how could I pass the value instead of the variable name ???
Code :
<!DOCTYPE html>
<html>
<body>
<h1>The XMLHttpRequest Object</h1>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
var Henry = "1234";
xhttp.open("GET", "demo_get2.asp?fname=Henry&lname=Ford", true);
xhttp.send();
}
</script>
</body>
</html>
Results :
The XMLHttpRequest Object
Request data
Hello Henry Ford
==> The result got Hello Henry Ford instead of Hello 1234 Ford