dudeshouse
02-23-2009, 02:55 PM
Hi,
I've just implemented my first bit of Ajax, calling an XML file to show live scores on a website. Everything seems to be fine on FF3 and Safari, but when the site is opened in IE7, a script error is thrown and it's impossible to navigate to any other page.
The Ajax is as follows:
<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("Sorry, your browser doesn't allow AJAX.");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('midFooter').innerHTML=xmlHttp.responseText;
setTimeout(Ajax(),60000);
}
}
xmlHttp.open("GET","/includes/livescores.asp",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout(Ajax(),60000); //***** Error line as described below *****
}
</script>
The script error that Internet Explorer throws is:
Line: 42
Char: 2
Error: Invalid Argument
Line 42 is the line above with asterixs in it...
I'm hoping that it's something simple that I've missed...
Any help would be greatly appreciated.
Thanks.
I've just implemented my first bit of Ajax, calling an XML file to show live scores on a website. Everything seems to be fine on FF3 and Safari, but when the site is opened in IE7, a script error is thrown and it's impossible to navigate to any other page.
The Ajax is as follows:
<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("Sorry, your browser doesn't allow AJAX.");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('midFooter').innerHTML=xmlHttp.responseText;
setTimeout(Ajax(),60000);
}
}
xmlHttp.open("GET","/includes/livescores.asp",true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout(Ajax(),60000); //***** Error line as described below *****
}
</script>
The script error that Internet Explorer throws is:
Line: 42
Char: 2
Error: Invalid Argument
Line 42 is the line above with asterixs in it...
I'm hoping that it's something simple that I've missed...
Any help would be greatly appreciated.
Thanks.