Global jQuery dialog variable not working properly

Posted by Ben Dauphinee on Stack Overflow See other posts from Stack Overflow or by Ben Dauphinee
Published on 2010-06-01T22:09:34Z Indexed on 2010/06/01 22:13 UTC
Read the original article Hit count: 220

When I call the function, the dialog does work. If I move the dialog construction into the showtimes_list function, everything works fine.

I thought that variables declared outside a function were global in context?

var dialog_list = $("<div></div>").dialog({
    autoOpen: false,
    modal: true,
    height: 300, width: 720,
});

function showtimes_list(sid){
    dialog_list.html("");
    $.get("ajax_showtimes.php?sid="+sid, function(data){
            dialog_list.html(data);
        }
    );

    dialog_list.dialog("open");
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jquery-ui