saribe / eModal

Easy Modal for bootstrap, is a simple way to create modal dialogs using javascript.
http://saribe.github.io/eModal
271 stars 97 forks source link

eModal AJAX call eModal confirm, confirm cannot be closed #79

Closed sherlyseptiani closed 5 years ago

sherlyseptiani commented 6 years ago

I call another eModal confirm from a button in a ajax modal, but the confirmation modal cannot respond.

var options = {
            url: "/passports/" + passportId,
            title:'Passport Details',
            size: eModal.size.m,
            buttons: [
                {text: 'Close', style: 'info',   close: true },
                {text: 'Delete', style: 'danger', click: function(){ 
                    eModal.confirm('Confirm delete passport?', 'Confirmation')
                    .then(
                        function okCallback(response){
                            console.log("Start deleting..")
                            $scope.deletePassport(passportId)
                            eModal.close()

                        },
                        function cancelCallback(response){
                            eModal.close()
                        }
                    );
                }}
            ]
        }
        eModal.ajax(options);
saribe commented 5 years ago

Works with jQuery 3 and bootstrap3, never tested with bootstrap4, eModal never got an update to work with bootstrap4 yet

var options = {
            url:'https://baconipsum.com/api/?type=all-meat&paras=2&start-with-lorem=1&format=html',
            title:'Passport Details',
            size: eModal.size.m,
            buttons: [
                {text: 'Close', style: 'info',   close: true },
                {text: 'Delete', style: 'danger', click: function(){ 
                    eModal.confirm('Confirm delete passport?', 'Confirmation')
                    .then(
                        function okCallback(response){
                            console.log("ACCEPT deleting..")
                            eModal.close()

                        },
                        function cancelCallback(response){
                            console.log("CANCEL deleting..")
                            eModal.close()
                        }
                    );
                }}
            ]
        }
        eModal.ajax(options);