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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -