simple ajax works in chrome and FF but not IE | Newbie | | Join Date: Nov 2008
Posts: 4
| |
This code works in Chrome and pulls a second drop down, but it will not work in IE6, (I dont have IE7/8 to check right now, but can later) and it works in FF, in IE it doesn't do anything at all.
Thanks for any help!
php code to push data to page: - <?php
-
$q=$_GET["q"]; //number
-
$blown = explode(',',$q);
-
$q = $blown[0];
-
$appl = $blown[1];
-
-
include "/home/advent1/public_html/secure/connect.php";
-
$clients= "'$_SESSION[group2]'";
-
-
-
-
-
-
-
?>
-
-
<select name="lookupanswers">
-
<option></option>
-
<?php
-
$i=1;
-
while ($i <= '10') {
-
$p="appl_quest{$i}_yn";
-
$m="appl_drop_{$q}_{$i}";
-
$n="quest{$i}_yn";
-
$sqlappl = "SELECT appl from client_table where appl = {$blown[1]}";
-
$resultappl = mysql_query($sqlappl) or die(mysql_error());
-
$appl = mysql_result($resultappl, 0);
-
-
$sqlapplquest = "select {$m} from lookup_table where appl = {$appl}";
-
$resultapplquest = mysql_query($sqlapplquest) or die(mysql_error());
-
$applquest = mysql_result($resultapplquest, 0);
-
-
if ($applquest == '') {
-
} else {
-
?>
-
<option value="<?php echo $i; ?>"><?php echo $applquest; ?></option>
-
<?php
-
}
-
$i++;
-
}
-
echo $sqlapplquest;
-
?>
Javascript code to make the ajax object. - var xmlhttp;
-
-
function showUser(str,appl)
-
{
-
xmlhttp=GetXmlHttpObject();
-
if (xmlhttp==null)
-
{
-
alert ("Browser does not support HTTP Request");
-
return;
-
}
-
var url="getanswer.php";
-
url=url+"?q="+str;
-
url=url+"&sid="+Math.random();
-
xmlhttp.onreadystatechange=stateChanged;
-
xmlhttp.open("GET",url,true);
-
xmlhttp.send(null);
-
}
-
-
function stateChanged()
-
{
-
if (xmlhttp.readyState==4)
-
{
-
document.getElementById("txtAnswers").innerHTML=xmlhttp.responseText;
-
}
-
}
-
-
function GetXmlHttpObject()
-
{
-
if (window.XMLHttpRequest)
-
{
-
// code for IE7+, Firefox, Chrome, Opera, Safari
-
return new XMLHttpRequest();
-
}
-
if (window.ActiveXObject)
-
{
-
// code for IE6, IE5
-
return new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
return null;
-
}
part of page its supposed to be updating. - Question:
-
<select name="lookups" onchange="showUser(this.value)">
-
<option></option>
-
<?php
-
$i = '1';
-
while ($i<'10') {
-
$sqlapplquest = "select appl_drop_{$i} from appl_table where appl = {$appl}";
-
$resultapplquest = mysql_query($sqlapplquest) or die(mysql_error());
-
$applquest = mysql_result($resultapplquest, 0);
-
-
if ($applquest != '') {
-
?>
-
<option value="<?php echo $i; ?>,<?php echo $appl; ?>"> <?php echo $applquest; ?> </option>
-
<?php
-
}
-
$i++;
-
}
-
?>
-
</select> Answered:<d id="txtAnswers"><select></select></d>
Thanks again!
| | Newbie | | Join Date: Nov 2008
Posts: 4
| | | re: simple ajax works in chrome and FF but not IE
found the problem, <d> isn't supported in IE6...thanks guys.
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,629
| | | re: simple ajax works in chrome and FF but not IE | | Newbie | | Join Date: Nov 2008
Posts: 4
| | | re: simple ajax works in chrome and FF but not IE
Its sloppy at best, but i ran outta other tags that i could use there, div kept putting it on the line under.
Its cool, no worries, its really not what ANYONE should use, and i'm not defending it. but it DID work in FF and Chrome, and not in IE, and that should be pointed out. Thats all.
|  | Moderator | | Join Date: Apr 2007 Location: New England
Posts: 7,148
| | | re: simple ajax works in chrome and FF but not IE
Did you try a <span>? Div is a block element, Span is in-line
|  | Expert | | Join Date: Jun 2007 Location: Urbana IL
Posts: 411
| | | re: simple ajax works in chrome and FF but not IE Quote:
Originally Posted by oneadvent found the problem, <d> isn't supported in IE6...thanks guys. it will work, as in stuff will show up, but it doesn't respond to CSS tag selectors, or have as many dom bindings like lang and name.
this should be fixed in the next version of IE.
|  | Similar JavaScript / Ajax / DHTML bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|