/    Sign up×
Community /Pin to ProfileBookmark

Multiple ajax and IE

So I have an ajax script that gets information from a php page and fills some select forms based on earlier options.
You make a selection in the first drop-down select menu and 6 others get updated with valid options.
I use a script that works in all browsers without problem, except for IE.
I have IETester and the debugger to see what goes wrong. If I view the source code from the generated page in IE it has retrieved the correct information from the script, but it is not displaying it. Weird?

Anyway, if anyone can help me that would be great. Here is the code I’m using. I call the function multipleAjax() onchange at the first <select>.

[code]
function multipleAjax() {

AjaxGet(“MyCmd”, “Thefirstfield”, “Thisfield”)
setTimeout(‘AjaxGet(“MyCmd”, “Thefirstfield”, “Thisfield”)’, 10);
setTimeout(‘AjaxGet(“MyCmd”, “Thefirstfield”, “Thisfield”)’, 20);
setTimeout(‘AjaxGet(“MyCmd”, “Thefirstfield”, “Thisfield”)’, 30);
setTimeout(‘AjaxGet(“MyCmd”, “Thefirstfield”, “Thisfield”)’, 40);
setTimeout(‘AjaxGet(“MyCmd”, “Thefirstfield”, “Thisfield”)’, 50);

}

function AjaxGet(cmd, tid, eid)
{

var xmlHttp=GetXmlHttpObject();

if (xmlHttp==NULL)
{
alert (“Your browser does not support AJAX!”);
return;
}

var id = document.getElementById(tid).value;

var url=”ajax.php?id=”+id;
url=url+”&cmd=”+cmd;
url=url+”&sid=”+Math.random();
xmlHttp.onreadystatechange = function() {

if (xmlHttp.readyState==4) {
document.getElementById(eid).innerHTML=xmlHttp.responseText;
}

};
xmlHttp.open(“GET”,url,true);
xmlHttp.send(null);

}

function GetXmlHttpObject()
{
var xmlHttp=null;
try // Firefox, Opera 8.0+, Safari
{
xmlHttp=new XMLHttpRequest();
}
catch (e) // Internet Explorer 6.0+
{
try
{
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”);
}
// 5.5+
catch (e)
{
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
}

return xmlHttp;
}
[/code]

Any help is greatly appriciated.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Quidam spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...