Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap: How to close modal dialog?

I'm trying to implement modal loading dialog with Twitter's bootstrap. My current attemp is:

$(document).ready(function () {

    $('#loading_dialog')
        .ajaxStart(function () {
            $(this).modal('show');
        })
        .ajaxStop(function () {
            $(this).modal('hide');
        });
});

Problem is that the dialog won't close.

like image 350
Fdr Avatar asked Jun 08 '12 06:06

Fdr


1 Answers

I didn't test it but the issue could depend on the context of the ajaxStart/Stop anonymous function.

Can you try this?

var loading_dialog = $('#loading_dialog');
loading_dialog
    .ajaxStart(function () {
        loading_dialog.modal('show');
    })
    .ajaxStop(function () {
        loading_dialog.modal('hide');
});
like image 66
Fabrizio D'Ammassa Avatar answered Oct 07 '22 18:10

Fabrizio D'Ammassa