Suppose I have the following url. With the help of getUrlVars below, we retrieve the id parameters.

http://somesite.com/index.php?id=123

var id = getUrlVars()["id"]; 

How to insert the value 123 into another variable of the JS file, for example like this:
var preLandUrl = "http://somesite.com/fit2/?ref=12&s= there should be 123 "

  • one
    var preLandUrl = "some url" + id - Dmitry Kulevich

2 answers 2

As I understand it, rather like this:

 var preLandUrl="http://somesite.com/fit2/?ref=12&s=" + id; 

Initially, we take from the link, then we add this value stored in a variable (in our case id) to another variable, and there we already do the manipulations we need.

    Add to line

     var preLandUrl="http://somesite.com/fit2/?ref=12&s=" + 123