Hey guys quick question, I am sending a request with the jquery ajax function with a variable. After the request I want that variable updated to match the value of the sent back information, so next time the ajax function executes, it send the value of the new variable.
EDIT
$(document).ready(function()
{
var countusers='<?php echo $countusers; ?>';
function refresh() {
$.ajax({
type: "POST",
data: "action=refresh_topic&countusers=" + countusers,
url: "tester.php",
dataType: 'json',
success: function(json)
{
var countusers=json.countusers;
}
})
}
setInterval(refresh, 3000);
});
the responce below is correct!
just a notation, since you are using
countusersalso before it change, it assume that you are setting it also before you call AJAX the first time!UPDATE: