Never mind, I've found the problem. I had neglected to set the content header for the return data from / actions/getModels_xml.php to 'text/xml'. Firefox was reading the text data as xml properly, whereas IE7 (rightly) wasn't.
On 30 May, 10:25, elkdanger <[EMAIL PROTECTED]> wrote: > Hi > > I've got a problem with using the each function and IE7. The code I > have works fine in Firefox, but not IE7. > > The basic problem I'm trying to overcome is I have one drop-down list > holding a list of car manufacturers, and a second one which contains a > list of cars by a manufacturer. The second box is populated based on > the choice of the first box. Specifically, when the first box is > changed, it fires an onChange event which retrieves the list of cars > for that manufacturer using $.post and populates the second list. > > The AJAX call returns an xml list of cars for that manufacturer, that > looks like: > > <models count='2'> > <model id='1'>Focus</model> > <model id='2'>Ka</model> > </models> > > And the code to retrieve it looks like: > > $.post("/actions/getModels_xml.php", { make: selectedMake }, > function(xml) > { > > selModelText = "<option value='' selected='selected'>Select a > model</ > option>"; > > $("model", xml).each(function() > { > selModelText += "<option value=" + > $(this).attr("id") + ">" + $ > (this).text() + "</option>"; > }); > > $("select#selModel").html(selModelText); > > // Select the first item in the list we just populated. > var frm = document.getElementById("frmMakeModel"); > frm.model.selectedIndex = 0; > > }); > > Now, in IE7 as soon as the code reaches the .each call execution seems > to stop. I've tried putting in alert()'s inside the .each and after > it, which don't execute. If I put one before the .each call, it works. > > Does anyone have any initial ideas? I've only posted the relevant > code. The above javascript is wrapped in a function called > 'addChangeHandlers()' and is called using $ > (document).ready(addChangeHandlers());. > > Any help would be much appreciated.