Good morning, I deal with mainly PHP but have some AJAX on my website, I seem to have a memory leak in my AJAX and don’t know what is wrong, If anyone has any ideas that would be great, maybe I am not taking care of my closures.
[CODE]
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js”></script>
function updateLobby() {
me = $.ajax({
url: “./includes/ajax/ajax.game_lobby.php?g=”+24,
cache: false,
async: false
}).responseText;
document.getElementById(“right_pane1”).innerHTML=me;
me = null;
setInterval(function() {
me = $.ajax({
url: “./includes/ajax/ajax.game_lobby.php?g=”+24+”&n=1”,
cache: false,
async: false
}).responseText;
if (me == 1) {
me = $.ajax({
url: “./includes/ajax/ajax.game_lobby.php?g=”+24,
cache: false,
async: false
}).responseText;
document.getElementById(“right_pane1”).innerHTML=me;
me = null;
}
}, 5000)
}
updateLobby();
</script>
Essentially this code serves two purposes, at first it pulls in the current users in a lobby, it then has an interval where it checks if anything has changed to the lobby, (if users have entered or left) if they have it will proceed to update the div element, otherwise it doesn’t modify the div. I have some other ajax on the page but I think I have narrowed it down to this bit of code.
Thanks for your help.