0

I want to open modal confirmation dialogue and based on that I'm operating some database operation as my need. So please suggest me the best way to open modal confirmation popup that should work even varnish cache or any cache is there.

1

1 Answer 1

0

As refereed by @MichaelHa

Try this Code:

<div id="popup-modal">
    <h1> Hi I'm here.... </h1>
</div>
<script>
    require(
        [
            'jquery',
            'Magento_Ui/js/modal/modal'
        ],
        function(
            $,
            modal
        ) {
            var options = {
                type: 'popup',
                responsive: true,
                innerScroll: true,
                title: 'popup modal title',
                buttons: [{
                    text: $.mage.__('Continue'),
                    class: '',
                    click: function () {
                        this.closeModal();
                    }
                }]
            };

            var popup = modal(options, $('#popup-modal'));

            $('#popup-modal').modal('openModal');
        }
    );
</script>

Hope this will help You!!

2
  • Please don't take other people's answers.
    – MichaelHa
    Commented Nov 8, 2019 at 8:37
  • Please check answer, Refereed by @MichaelHa Commented Nov 8, 2019 at 8:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.