0

If I seem short, sorry, but I am having difficulty describing how I am to make an operation through a shared link.

How would I make a function in a javascript to open a dynamic link such as

mycompany.com/?l_id=150#signin

where the id will give a user an item to call.

How do I make the program start with ?l_id=150 because upon clicking the link it gives me the address

mycompany.com/#signin
  • Are-you looking for something like `window.location`? https://developer.mozilla.org/en-US/docs/Web/API/Window/location – Tolokoban Mar 19 '15 at 16:14
  • Hey thanks for the reply, not sure what that is but I will posy my solution below. can you explain what window.location is? – Unhinged Titan Mar 19 '15 at 18:23

1 Answers1

0

Tolokaban was right, but here is the actual function if anyone needs it.

    function queryToObject(){
        var l, o = {}, q = window.location.search.replace("?", "");
        q = q.split("&");
        for(var i = 0; i < q.length; i++){
            l = q[i].split("=");
            if(!l[0]) continue;
            o[l[0]] = l[1];
        }
        return o;
    }