I have the following code:
var update_value = show_dialog("Do you want to continue?", "OK!", "Skip");
alert (update_value);
and something like
- function show_dialog(text, button1, button2){
var update = '';
$('<div></div>').dialog(
{
buttons: [{
{text: button1,click: function(){update = 'yes'; $(this).dialog("close");}},
{text: button2,click: function(){update = 'no'; $(this).dialog("close");}}
}],
modal: true
}
).html(text);
return update;
};
The problem is the alert in main body of the program is effectively called before the dialog box is: it covers the dialog box. All I really want is the value of "update" or "update_value". I've tried it with the dialog option modal true and false. I've tried using a global variable and setting it within the dialog call and the show_dialog function. None of it works. Basically the program is not waiting for a button to be clicked before returning to the flow. This seems odd.... Am I doing something wrong? Is the nature of the ui dialog?