Hi everyone,
I AM TRYING TO LEARN AJAX FOLLOWING IS THE EXAMPLE I HAVE COPIED FROM SOME TUTORIAL.
<html>
<body>
<script type="text/javascript">
var xmlreq;
function newxmlreqRequest() {
alert(window.xmlreqRequest);
if (window.xmlreqRequest) {
xmlreq = new xmlreqRequest();
} else if (window.ActiveXObject) {
alert(window.ActiveXObject);
try {
alert(window.ActiveXObject);
xmlreq = new ActiveXObject("Msxml2.xmlreq");
alert(xmlreq);
}
catch (e1) {
alert("catch1");
try {
alert(window.ActiveXObject);
xmlreq = new ActiveXObject("Microsoft.xmlreq");
alert(xmlreq);
} catch (e2) {
alert("catch2");
}
}
}
alert(xmlreq);
xmlreq.onreadystatechange= callbachHandler();
url = document.getElementById("selshow").value+".htm"
xmlreq.open("POST", url, true);
xmlreq.send(null);
}
function callbachHandler()
{
if(xmlreq.readyState==4)
{
document.getElementById("divCharecters").innerHTML =xmlreq.responseText;
}
}
</script>
<form name="myForm">
<select onchange= "newxmlreqRequest()" id="selshow">
<option value=""></option>
<option value="a1">abc</option>
<option value="a2">efg</option>
<option value="a3">xyz</option>
</select>
<br><br>
<div id="divCharecters">
<select></select>
</div>
</form></body>
</html>
HERE in function newxmlreqRequest() xmlreqRequest object is not getting created. i am getting alert 'alert("catch2");' . my browser version is IE7.
I AM TRYING TO LEARN AJAX FOLLOWING IS THE EXAMPLE I HAVE COPIED FROM SOME TUTORIAL.
<html>
<body>
<script type="text/javascript">
var xmlreq;
function newxmlreqRequest() {
alert(window.xmlreqRequest);
if (window.xmlreqRequest) {
xmlreq = new xmlreqRequest();
} else if (window.ActiveXObject) {
alert(window.ActiveXObject);
try {
alert(window.ActiveXObject);
xmlreq = new ActiveXObject("Msxml2.xmlreq");
alert(xmlreq);
}
catch (e1) {
alert("catch1");
try {
alert(window.ActiveXObject);
xmlreq = new ActiveXObject("Microsoft.xmlreq");
alert(xmlreq);
} catch (e2) {
alert("catch2");
}
}
}
alert(xmlreq);
xmlreq.onreadystatechange= callbachHandler();
url = document.getElementById("selshow").value+".htm"
xmlreq.open("POST", url, true);
xmlreq.send(null);
}
function callbachHandler()
{
if(xmlreq.readyState==4)
{
document.getElementById("divCharecters").innerHTML =xmlreq.responseText;
}
}
</script>
<form name="myForm">
<select onchange= "newxmlreqRequest()" id="selshow">
<option value=""></option>
<option value="a1">abc</option>
<option value="a2">efg</option>
<option value="a3">xyz</option>
</select>
<br><br>
<div id="divCharecters">
<select></select>
</div>
</form></body>
</html>
HERE in function newxmlreqRequest() xmlreqRequest object is not getting created. i am getting alert 'alert("catch2");' . my browser version is IE7.