php - Javascript value won't change -
i have 2 files: first script.js
; second index.php
(but in file script.js
included).
i have declared in script.js
global variable time = 12000
, when if stime()
called, variable time should changed 2000. variable pass variable in index.php won't chages... problem ?
script.js
var time = 1200; function stime() { time = 2000 }
index.php
var tick = time; // variable pass var script.js (time) var interval; var l = 5; function time_reset() { interval = setinterval(function() { if (l > 0) { post(4); // ajax function l = l - 1; } }, tick); //interval time }
one more thing can tell me how can stop function time_reset()?
Comments
Post a Comment