New answers tagged

2

mage/url widget is not used to fetch backend base URL in Magento 2. You need to create a template file using layout XML and define the base URL of backend under the template file. You can define any Global variable and set your URL in it. Create a simple layout XML file to fetch backend URL of the site using JS, Create default.xml file for global ...


1

In phtml file add this code: <input type="hidden" id="testUrl" value="<?php echo $this->getUrl(); ?>"/> By using Id we can get base url in JS file $("#testUrl").val(); Hope it will help


Top 50 recent answers are included