This is more of a JavaScript question than an SDK question...
I would use an external variable, like this:
var userResponse = "";
var dialog1 = {
// dialog definition
}
And then inside the dialog object insert these functions:
ok: function(dialog) {
userResponse = "ok";
},
cancel: function(dialog) {
userResponse = "cancel";
}
And then you execute the dialog and examine the value of userResponse, instead of the return value of the execDialog function, like so:
app.execDialog(dialog1);
if (userResponse=="ok") {
} else if (userResponse=="cancel") {
} else {} // do nothing