Get URL parameters using Javascript

Enercos - Single Product eCommerce Shopify Theme

With PHP, We easily get the URL by $_GET method. With JavaScript is not so easy but you still can do that with function below:

Now you can using this function get URL parameter.

Example you want get parameter from “name” parameter in URL: http://domain.com/index.php?name=Kiet. And this is code:

Good luck!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *