I'm not going to show you my comet code, because it's not necessarily the problem. Rather, I'm going to ask how I could close connections when the page is unloaded? I'm using jQuery to establish a long poll to a page called home_comet.php. Maybe there's a way to tell IE to close the ajax request when the page is left.
Thanks, and all help is appreciated.
[EDIT] I fortunately decided to show you some code:
Code: Select all
(function homeCometCallback(data)
{
if (data)
{
var json = eval("("+data+")");
for (var category_id in json)
{
var fields = json[category_id];
var listElement = $(".catbox.category-"+category_id+" ul");
//Check light or dark class
var coloringClass = listElement.children(":first").hasClass("light") ? "dark" : "light";
//Prepend data to the list element
listElement.prepend("<li class='"+coloringClass+"'>"
+"<a href='/view_post.php?id="+fields['id']+"'>"
+fields['title']
+" <span class='specific-location'>("
+fields['specific_location']
+")</span>"
+"</a>"
+"<span class='price'>$"+fields['price']+"</span>"
+"</li>");
//Delete rows after five
listElement.children().eq(3).remove();
}
}
$.get("/home_comet.php?"+Math.random(), {location: $_GET['l']||""}, homeCometCallback);
})("");