How to pass PHP variables from phtml files to RequireJs in Magento 2?

In Magento 2, we can use Declarative notation to pass dynamic PHP values to RequireJs from template files. Magento templates support <script type=”text/x-magento-init”> … </script> tag to fulfill this requirement. First, create a module e.g. Webiins_ExitPopup and add a file exitpopup.phtml at location app/code/Webiins/ExitPopup/view/frontend/templates to add declarative notation: We can access these parameters in app/code/Webiins/ExitPopup/view/frontend/web/js/exitpopup.js …