By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,312 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

simple ajax works in chrome and FF but not IE

P: 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:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $q=$_GET["q"]; //number
  3. $blown = explode(',',$q);
  4. $q = $blown[0];
  5. $appl = $blown[1];
  6.  
  7. include "/home/advent1/public_html/secure/connect.php";
  8. $clients= "'$_SESSION[group2]'";
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15. ?>
  16.  
  17. <select name="lookupanswers">
  18. <option></option>
  19. <?php
  20. $i=1;
  21. while ($i <= '10') {
  22. $p="appl_quest{$i}_yn";
  23. $m="appl_drop_{$q}_{$i}";
  24. $n="quest{$i}_yn";
  25. $sqlappl = "SELECT appl from client_table where appl = {$blown[1]}";
  26. $resultappl = mysql_query($sqlappl) or die(mysql_error());
  27. $appl = mysql_result($resultappl, 0);
  28.  
  29. $sqlapplquest = "select {$m} from lookup_table where appl = {$appl}";
  30. $resultapplquest = mysql_query($sqlapplquest) or die(mysql_error());
  31. $applquest = mysql_result($resultapplquest, 0);
  32.  
  33. if ($applquest == '') {
  34. } else { 
  35. ?>
  36. <option value="<?php echo $i; ?>"><?php echo $applquest; ?></option>
  37. <?php
  38. }
  39. $i++;
  40. }
  41. echo $sqlapplquest;
  42. ?>
Javascript code to make the ajax object.
Expand|Select|Wrap|Line Numbers
  1. var xmlhttp;
  2.  
  3. function showUser(str,appl)
  4. {
  5. xmlhttp=GetXmlHttpObject();
  6. if (xmlhttp==null)
  7.   {
  8.   alert ("Browser does not support HTTP Request");
  9.   return;
  10.   }
  11. var url="getanswer.php";
  12. url=url+"?q="+str;
  13. url=url+"&sid="+Math.random();
  14. xmlhttp.onreadystatechange=stateChanged;
  15. xmlhttp.open("GET",url,true);
  16. xmlhttp.send(null);
  17. }
  18.  
  19. function stateChanged()
  20. {
  21. if (xmlhttp.readyState==4)
  22. {
  23. document.getElementById("txtAnswers").innerHTML=xmlhttp.responseText;
  24. }
  25. }
  26.  
  27. function GetXmlHttpObject()
  28. {
  29. if (window.XMLHttpRequest)
  30.   {
  31.   // code for IE7+, Firefox, Chrome, Opera, Safari
  32.   return new XMLHttpRequest();
  33.   }
  34. if (window.ActiveXObject)
  35.   {
  36.   // code for IE6, IE5
  37.   return new ActiveXObject("Microsoft.XMLHTTP");
  38.   }
  39. return null;
  40. }
part of page its supposed to be updating.
Expand|Select|Wrap|Line Numbers
  1. Question:
  2. <select name="lookups" onchange="showUser(this.value)">
  3. <option></option>
  4. <?php
  5. $i = '1';
  6. while ($i<'10') {
  7. $sqlapplquest = "select appl_drop_{$i} from appl_table where appl = {$appl}";
  8. $resultapplquest = mysql_query($sqlapplquest) or die(mysql_error());
  9. $applquest = mysql_result($resultapplquest, 0);
  10.  
  11. if ($applquest != '') {
  12. ?>
  13. <option value="<?php echo $i; ?>,<?php echo $appl; ?>">  <?php echo $applquest; ?>  </option>
  14. <?php
  15. }
  16. $i++;
  17. }
  18. ?>
  19. </select> Answered:<d id="txtAnswers"><select></select></d>
Thanks again!
Sep 20 '09 #1
Share this Question
Share on Google+
6 Replies


P: 4
found the problem, <d> isn't supported in IE6...thanks guys.
Sep 20 '09 #2

Plater
Expert 5K+
P: 7,872
What IS "<d>"?
I do not see it listed here:
http://www.w3schools.com/tags/default.asp
Sep 23 '09 #3

Dormilich
Expert Mod 5K+
P: 8,639
itís also not listed here http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
Sep 23 '09 #4

P: 4
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.
Sep 25 '09 #5

Plater
Expert 5K+
P: 7,872
Did you try a <span>? Div is a block element, Span is in-line
Sep 25 '09 #6

rnd me
Expert 100+
P: 427
@oneadvent
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.
Sep 28 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.