update variable after success of ajax function
<p>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.<br>
<strong>EDIT</strong></p>

<pre><code>$(document).ready(function()
{
var countusers='&lt;?php echo $countusers; ?&gt;';

function refresh() {

 $.ajax({
   type: "POST",
   data: "action=refresh_topic&amp;countusers=" + countusers,
   url: "tester.php",
    dataType: 'json',
   success: function(json)
   {
    var countusers=json.countusers;
 }
})
}
setInterval(refresh, 3000);

    });
</code></pre>
