U
UKuser
Hi,
I'm working on the following code, which works fine in Firefox, but
not in IE. The problem is its not posting the variable to my page and
I'm thinking its something wrong with the getElementByID but the code
is as per an example on a tutorial website (http://www.tizag.com/
ajaxTutorial/ajax-javascript.php).
The Select element is as follows:
<select style="width:240px;font-size:8pt" id='servicet'
onchange='ajaxFunction()' name="servicet" >
So not quite sure what I've done wrong here??
Any thoughts would be great.
Thanks
A
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax
possible!
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){
var ajaxDisplay = document.getElementById('output');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var srv = document.getElementById('servicet').value;
var queryString = "?serv=" + srv;
ajaxRequest.open("GET", "ajax.php" + queryString,
true);
ajaxRequest.send(null);
}
I'm working on the following code, which works fine in Firefox, but
not in IE. The problem is its not posting the variable to my page and
I'm thinking its something wrong with the getElementByID but the code
is as per an example on a tutorial website (http://www.tizag.com/
ajaxTutorial/ajax-javascript.php).
The Select element is as follows:
<select style="width:240px;font-size:8pt" id='servicet'
onchange='ajaxFunction()' name="servicet" >
So not quite sure what I've done wrong here??
Any thoughts would be great.
Thanks
A
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax
possible!
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){
var ajaxDisplay = document.getElementById('output');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var srv = document.getElementById('servicet').value;
var queryString = "?serv=" + srv;
ajaxRequest.open("GET", "ajax.php" + queryString,
true);
ajaxRequest.send(null);
}