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.

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!!

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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