Is there a way to make a POST request in Javascript/jQuery and use that variable as a setTimeout
time?
$.post('file.php', { action: "gettimeout"},
function(time){
return time;
});
setInterval(function(){ alert("Hello"); }, time);
is what I am trying to do.
I am currently able to do but I am doing it synchronously.
var time = $.ajax({
type: 'POST',
url: 'file.php',
data: {action: "gettimeout"},
async: false
});
return Number(time.responseText);
setInterval(function(){ alert("Hello"); }, time);