Problem solved it was an extra , after the last {optionValue: '". $b ."', optionDisplay: '". $b ."'} in the php file. firefox must have ignored it while ie expected more.
On 19 Okt, 16:49, Greg Riley <goh...@gmail.com> wrote: > You are setting options inside a function and then trying to reference > it outside of that function. > > Try putting var options = ''; before that first line. > > On Oct 19, 10:22 am, Patrik <patrik.spat...@gmail.com> wrote: > > > Hi, > > I have this code and it works well in firefox but in IE it dosn't. > > How do I make it work in IE? > > If I put alert(options) inside the loop I get all the values I want so > > this far it's working but outside the loop if i call alert(options) > > nothing happens. why? > > > $("select#kod").change(function(){ > > $.getJSON("artnr-ajax.php",{value: $(this).val(), where: 'kod'}, > > function(j){ > > var options = ''; > > for (var i = 0; i < j.length; i++) { > > options += '<option value="' + j[i].optionValue + '">' + j > > [i].optionDisplay + '</option>'; > > } > > $("select#beteckning").html(options); > > > })