I set Tomcat to be run on 80 port and have an jsp that returns html. Why doesn't it work? It doesn't even turn on alert 2. What's matter. Please, tell me.
Code:
<html>
<head>
<script type="text/javascript">
function getCustomerInfo()
{
alert("1!");
var request = new XMLHttpRequest();
var a = document.getElementById("aa").value;
var url = "http://localhost/MyProject/index.html";
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.send();
alert("2!");
}
function updatePage()
{
document.getElementById("myDiv").innerHTML="aaa";
}
</script>
</head>
<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="getCustomerInfo()">Change Content</button>
</body>
</html>
Comment