Redirect URL within Facebox

1.3k views Asked by At

Take the "Terms of Service" example found on the developers page. If you click on "Ok," I want the page to redirect elsewhere. I'm modifying this code to show an image and the "Ok" button is really a delete button. I have everything working, except I'm not sure how to tie that button into an action.

  function picFunction(theurl) {
    var imgBox = new Facebox({
        ajaxDelay: 100,
        draggable: false,
        title: 'Terms and conditions',
        url: theurl,
        submitValue: 'Delete',
        submitFunction: function() {
            imgBox.fade();
            var confirm = new Facebox({
                width: 200,
                title: 'Confirm',
                message: 'Are you sure you want to delete?',
                submitValue: 'Yes',
                cancelValue: 'No',
                submitFunction: function() {
                    confirm.close();
                    imgBox.close();
                },
                cancelFunction: function() {
                    confirm.fastclose();
                    imgBox.unfade();
                }
            });
            confirm.show();
        }
    });
    imgBox.show();
}
1

There are 1 answers

2
Jacob On BEST ANSWER

You need to update the window location to reload the page at the given URL. So your inner submitFunction should look something like this, you don't need to worry about closing the Facebox because the page will redirect anyway.

submitFunction: function() {
    window.location = 'http://www.pagetosendto.com'
}