Search code examples
javascriptwebhrefmobile-application

Dynamic link to perform javascript and JSON log in


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

Solution

  • 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;
        }