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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -