Thread: Problem with IE
View Single Post
  #8 (permalink)  
Old August 23rd, 2007, 05:27 PM
nick4u1lee nick4u1lee is offline
Registered User
Join Date: Aug 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks a lot very helping I really appreciate your help. Well like you said I parse the string but I did in slight different way like I said I am new to AJAX. So, I took advantage from PHP side since I am good in that. Now just in case if you are wondering here's how I did it.
instead of returning string in this format from server
<option value="1">Shoes</option>

I modified my server output to return string in this format

Now all I did was split with @
and for every values I added it as option like this

function removeOptions (optionMenu)
  for (var i=0; i < optionMenu.options.length; i++)
    optionMenu.options[i] = null;

function popoulate(valuearray, optionMenu)
  var breakdown = valuearray.split("@");
  var reallength = (breakdown.length-1)/2;
  var i = 0;
  var forvalue = 0;
  var forlabel = 1;
  removeOptions (optionMenu);

  while (i < reallength)
    optionMenu[i] = new Option(breakdown[forlabel],breakdown[forvalue]);
    forvalue = forvalue + 2;
    forlabel = forlabel + 2;

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
         popoulate(xmlHttp.responseText, document.getElementById("subcat"));//xmlHttp.responseText;

That's it
I am very sorry if you are Microsoft person but I really hate IE in many terms. I don't know whether you have ever heard about FLEX or not. But this is one kind of situation where I prefer Flex over AJAx because in Flex you don't fall around this kind of problem. But by saying this I am not trying to say that AJAX is bad. Sure it have many good sides. Long discussion short; lastly I would like thank you for your help.... if you ever decided to contact me