jquery - How to get hashed value from URL -
how hashed value url separate variables url#value1=abc&value2=xyz&value3=123
this
var value1 = 'abc'; var value2 = 'xyz'; var value3 = 123;
if variable not present in url then,
var value4 = 0;
i used window.location.hash
hashed value, how separate separate variables.
seems better choice use array , not separate variables.
var hashvalues = window.location.hash.substr(1).split("&");
and id want them in variables, might better object instead of flooding global scope.
var vals = { "value1" : 0 }; for(var i=hashvalues.length;i++) { vals["value"+i] = hashvalues[i]; }
Comments
Post a Comment