I have a js variable with many functions, and I want to create in one of them a global variable visible in another php file that load the js file.
How can I do that ?
Thanks for help.
Thaks for help : here’s an edit :
The variable has a dynamic value and is generated on event.keyCode I have tried in my js file:
window.selected_sku = null; in the top of the js file
and in the appropriate function :
window.selected_sku = v;
In my php within javascript code, I have :
if(window.selected_sku!=null){
alert(window.selected_sku);
}
but I don’t get any alert !!
Help..
assign it to window
when you include the js file you can access the variable in any file.