Create a global javascript or jQuery variable visible in many pages -


i have js variable many functions, , want create in 1 of them global variable visible in php file load js file.

how can ?

thanks help.

thaks : here's edit :

the variable has dynamic value , generated on event.keycode have tried in js file: window.selected_sku = null; in top of js file

and in appropriate function :

window.selected_sku =  v; 

in php within javascript code, have :

    if(window.selected_sku!=null){         alert(window.selected_sku);     }    

but don't alert !!

help..

assign window

window.variable = "this variable". 

when include js file can access variable in file.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -