Ajax query...

Joined
Nov 11, 2008
Messages
3
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top