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

strange ajax behaviour in firefox 3.0.4

P: 82

I am running ajax call to my appache local server on my development server, which is also my testing server, I run the site from the server (the server running php,mysql), what I get back is a list from the server and than I use innerHTML to plant it into the page.

Expand|Select|Wrap|Line Numbers
  1.   select id="'modelName'" style="width:130">
  3.                 <option value="none"  selected>none</option>
  5.            </select>
The issue is that the method is working in IE6, Opera ver 9.62, Safari ver 3.3. But when I come and run it on FF 3.0.4 I can not see the list box. I ran the firebug and I see actually that the ajax call was done and the list box was created but for some reason it refuse to insert it into the DIV(I did not got any error from the firebug), I know it ran from me with firefox 2, now is something change in FF and I don't now why. I thought this is a cross connect issue but I don't get any indication from the firebug can someone please advise.


Nov 23 '08 #1
Share this Question
Share on Google+
6 Replies

rnd me
Expert 100+
P: 427
I am surprised to hear this works for IE.
innerHTML is not the best way to populate options.

try using a wrapper span around the select tag, and reinstering the whole select tag instead of just the options.
Nov 23 '08 #2

P: 82
rnd me,
Thanks for your reply, it works great but for some reason it stop for FF3.0.4. I think it some kind of security in FF issue that disable it from being showing, since I run my FF on the server, maybe it is the FF cross domain issue.
Nov 23 '08 #3

Expert 5K+
P: 7,435
This line might be the problem:
select id="'modelName'" style="width:130">

Change it to:
select id="modelName" style="width:130px">

Perhaps your extra quotes above are still needed but need to be escaped? Plus, you don't have any units on the width, which is required.
Nov 23 '08 #4

Expert Mod 15k+
P: 16,027
This would only be a problem if it was actually from another domain, and then it wouldn't work in other browsers either.

Show the code where you set the innerHTML, and is the code returned from the PHP page exactly as you posted in your first post?
Nov 24 '08 #5

P: 82

The function that perform the ajax call is:

Expand|Select|Wrap|Line Numbers
  2. function GetXmlHttpObject(divID,url)
  3. {
  4.   xmlHttp=XmlHttpObject();
  6.  if (xmlHttp==null)
  7.  {
  8.    alert("Your browser does not support AJAX!");
  9.    return FALSE;
  10.  }       
  11.    xmlHttp.onreadystatechange = function() 
  12.    {
  13.      if (xmlHttp.readyState == 4 && xmlHttp.status==200) 
  14.      {           
  15.         document.getElementById(divID).innerHTML=xmlHttp.responseText;
  16.      }else
  17.      {
  18.         alert('false');
  19.      }
  20.    }
  21."GET", url,false); 
  22.      xmlHttp.send(null);
  24. }
and the returned list box from the server is as I posted before.
Nov 25 '08 #6

Expert Mod 15k+
P: 16,027
Hmm... You're making a synchronous request, so there's no need for onreadystatechange. Just put the function code below send().
Nov 25 '08 #7

Post your reply

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