Thanks but it didnt help and the reference is inside of the funktion
missed to put  }) }) in my message.

nothing inside the getJSON function will work after the closing } in
the for loop if i put alert("after"); won't show or anything else.

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);
>
> > })

Reply via email to