This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

uitlab
uitlab

Hello, how to confirm ajax request i try but nothing work thanks!


$(window).on('ajaxConfirmMessage', function(event, message){     

    bootbox.confirm(message, function(result) {
        return result;
    });   

    event.preventDefault();  

});
mambroz
mambroz

You need to resolve the deferred object. Your event handler also needs to return a value.

$(window).on('ajaxConfirmMessage', function(event, message) {
    // Stop the default confirm dialog
    event.preventDefault();

    // Okay Button
    $('#okay-button').click(function() {
        // Resolve the deferred object, this will trigger whatever was being confirmed
        event.promise.resolve();
    });

    // Cancel Button
    $('#cancel-button').click(function() {
        // Reject the object, this will cancel whatever was being confirmed
        event.promise.reject();
    });

    // Return a value so the framework knows we're handling the confirm
    return true;
});

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.