Howdy Everyone,
I've been banging my head against this for a bit now and have been reading all kinds of things - but, everything I try has failed. So, I thought I'd ask.
I've just begun working with Javascript/Ajax .. in the last day to try and accomplish a task but, I can't seem to get this code to work in IE it works fine in Firefox.
Perhaps someone can enlighten me - Basically, this is calling back from a php file that updates from a database to choose dropdowns/checkbox based on the users choices.
Any help is greatly appreciated.
function getSex(theSex, myParent){
var ajaxRequest;
try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
responcer = ajaxRequest.responseText.split(",");
size = responcer.length - 1;
myParent.age.innerHTML = "";
for(i = 0; i < size;i++)
if(responcer[i] != "")
myParent.age.innerHTML += '<option value="' + responcer[i] + '">' + responcer[i] + '</option>';
}
}
ajaxRequest.open("GET", "test.php?theSex=" + theSex, true);
ajaxRequest.send(null);
}
function getBelt(theId, myParent){
var ajaxRequest;
try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
responcer = ajaxRequest.responseText.split(",");
size = responcer.length - 1;
myParent.second.innerHTML = "";
for(i = 0; i < size;i++)
if(responcer[i] != "")
myParent.second.innerHTML += '<option value="' + responcer[i] + '">' + responcer[i] + '</option>';
}
}
ajaxRequest.open("GET", "test.php?id=" + theId, true);
ajaxRequest.send(null);
}
function getReg(theBelt, myParent){
var ajaxRequest;
try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
responcer = ajaxRequest.responseText.split(",");
size = responcer.length - 1;
document.getElementById("third").innerHTML = "";
for(i = 0; i < size;i++)
if(responcer[i] != "")
document.getElementById("third").innerHTML += '<input type="checkbox" name ="third[]" value="' + responcer[i] + '">' + responcer[i] + '</input><br />';
}
}
ajaxRequest.open("GET", "test.php?theBelt=" + theBelt, true);
ajaxRequest.send(null);
}
-Steven