I have a javascript function that shows a jQuery dialog. In my function I want to build the list of buttons based on parameters passed. How should I build this list and pass it to the dialog method? I have tried building a query and passing it like this:
buttons=new Array();
buttons["Ok"]="function() {$(this).dialog('close');}"
And then calling dialog like this:
$("#alert").dialog({title: "Title", buttons:buttons});
When I try that no buttons appear. However, when I do the following the button appears:
$("#alert").dialog({title: "Title", buttons:{"Ok":"function() {$(this).dialog('close');}"}});
What am I doing wrong?