[jQuery] Ajax and DOM Nodes -- multiplying
I hope that I post this in the right spot.
Ok... so I am using this program called 'Drip' to check why IE is
crashing on my scripts after a few hours.
I have a header panel, that refreshes every 20 seconds like this:
headertimer = setInterval("messageLoad()", 20000);
messageLoad();
the headerLoad() function, looks like this:
function messageLoad()
{
$.ajax({
url: "/user/header/ajax",
cache: false,
dataType: "html",
success: function(html){
$("#mtemp").remove();
$("#headerLoginMessages").html('<div id="mtemp"></div>');
$("#mtemp").html(html);
}
});
//loadContent('headerLoginMessages', '/user/header/ajax', '');
//headerMessageAjax();
}
in the body of the site, i have this near the top of the page in the
<body>:
<div id="headerLoginMessages"></div>
NOW... what I dont understand, is using the DRIP application, it shows
that the DOM nodes increase with ever iteration of the messageLoad()
fucntion, yet, i am removing them on success using the .remove()...
Why/How is this still adding more and more and more, and then
eventually if you dont refresh the page, it ends up crashing the
script?
When i look at facebook.com in DRIP, and I use the chat, it added the
dom nodes fro the chat, and when it refreshed, it didn't keep adding
more and more nodes...
Am I doing something wrong here?