I have two files: the first is script.js; the second is index.php (but in this file script.js is included).
I have declared in script.js global variable time = 12000, but when if sTime() is called, the variable time should be changed to 2000. That variable i pass to another variable in index.php but it won't chages... What is the problem ?
SCRIPT.js
var time = 1200;
function STime() {
    time = 2000
}
INDEX.php
var tick = time; // to this variable i pass var from script.js (time)
var interval;
var l = 5;
function time_reset() {
    interval = setInterval(function() {
        if (l > 0) {
            post(4); // some ajax function
            l = l - 1;
        }
    }, tick); //interval time
}
One more thing is someone can tell me how i can stop this function time_reset()?
 
    