jquery - Javascript URL Parameter Capture Not Working Properly -


i working on django website have search function in can choose version, server, , user , display relevant results. implementing share button can go search results. first tested page variables set myself see if table of results load , worked fine. trying use js function capture url parameters , display results based on (the whole point).

this js function using:

    function getqueryvariable(variable){        var query = window.location.search.substring(1);        var vars = query.split("&");        (var i=0;i<vars.length;i++) {                var pair = vars[i].split("=");                if(pair[0] == variable){return pair[1];}        }        return(false);    } 

i have tested function online , returns correct information want. on page should load tables gets stuck on loading forever. when using preset variables works perfectly. need find difference between , function returns.

this how tested functionality:

   var version = "01.002.157.01.00.00.18823";    var server = "balinor";    var user = "jenkins"; 

when testing function online, returns values i'm not sure difference is! appreciated.

the problem window.location.search.substring(1); not returning part of url wanted. used window.location.href , parsing of url worked perfectly!

what helped me solve problem use console.log see variables in fact not thought were. shang wang one. solving problems simpler think!


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -