How to Get Magento 2 URL in JS File

in #magento4 years ago

The post shows the technique to get Magento 2 URL in the JS document. For instance, you are trapped in a circumstance where you need to get url from .js record and add it with your module regulator connect from. Indeed, it is absurd to expect to utilize the block to get the url.

How-to-Get-Magento-2-URL-in-JS-File-Social-Share.png

You might expect to get the URL in JS record and it isn't prescribed to utilize the static URL similarly as with time, the URL key might change and the static worth will give you the mistake.

Subsequently, carry out the beneath technique to get Magento 2 URL in JS file.

For more Info. visit: https://meetanshi.com/blog/get-magento-2-url-in-js-file/

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.102
BTC 63986.79
ETH 1856.21
USDT 1.00
SBD 0.39