0
buttons     : {
            Ok: function() {
                $(this).dialog('close');
                return (typeof callback == 'string') ?
                  window.location.href = callback :
                  callback();
            },
            Cancel: function() {
                $(this).dialog('close');
                return false;
            }
        },

For jquery UI, I need to return values the same as a javascript confirm message a 1 and a 0

I assume I do a callback, but unsure how to reference the callback...

EDIT

jsp developer stated that he doesn't neccessarily need a callback, but needs to be able to do something similar to:

if (answer == true) { 
        //do something 
} 
else { 
        //do something different 
} 

how would I do that?

1 Answer 1

1

You cannot do a return in a jquery dialog.

What you can do:

buttons: {
        Ok: function() {
            $(this).dialog('close');
            callback_fn(1);
        },
        Cancel: function() {
            $(this).dialog('close');
            callback_fn(0);
        }
    },


//later on:
function callback_fn(bool){
    //do something with the 1 or 0
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.