Why is my PHP variable not changing when my Javascript code runs? -


i have counter timer , tried block simple bypass download without waiting.

so in main class declared boolean

$allow_download = false; 

and in javascript when time elapsed

else  {     textdlshow.style.display = 'none';     divdlshow.style.display = '';     "<?php $allow_download = true;?>"; } 

and in second class

if($allow_download == false) echo "test"; 

well, when time elapsed boolean not set positive value. suggestions ??

thanks time !!

javascript cannot set value of php variable since javascript interpreter cannot parse php (nor variable in same interpreter anyway, since javascript run on client's browser rather on server.)

in order need make new request javascript php code can read in order set $allow_download true , serve download.

you'll want read on ajax, document.createelement (because 1 way might create iframe pointing @ download location after time has elapsed) , settimeout.


Comments

Popular posts from this blog

Python __call__ special method practical example -

arrays - jQuery - Retrieve values from HTML elements and return their sum -