Перезагрузите содержимое div afer регулярного промежутка времени

Я хочу повторно загрузить содержимое div (Recent_updates) через регулярный промежуток времени. Я использовал следующий код javascript

var refreshId = setInterval(function() { $('#Recent_updates').fadeOut("slow").load('Recent_updates.php').fadeIn("slow"); }, 60000); 

Recent_updates.php

 <?php include("include/connect.php"); include("library/paginator.php"); ?> <div style="text-align:right;"> <? $query = "select * from settings"; $tab = mysql_query($query); $row = mysql_fetch_array($tab); $item_no = $row['items_to_show']; $scroll = $row['scroll_interval']; $online_paginate = new Paginator; $online_paginate->sql = "select * from recent_updates where status='Active' and picture1!='' and selling_method!='want_it_now' and selling_method!='ads' and bid_starting_date <= now() and expire_date>=now() order by item_id desc"; // sql statement $online_paginate->rows_on_page = $item_no; $results = $online_paginate->get_page_result(); // result set $num_rows = $online_paginate->get_page_num_rows(); // number of records in result set $nav_links = $online_paginate->navigation("&nbsp; | &nbsp;"); // the navigation links (define a CSS class ?> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#d79196" class="detail9txt"> <input type="hidden" value="2" name="len"> <td align="center" width="20%"><b>Picture</b> </td> <td width="30%" align="center"><b>Name / Responses</b> </td> <td width="50%" align="center"><b>Description</b> </td> </tr><tr style="height:10px;"><td></td></tr> <? if ($num_rows > 0) { while ($bestsellers_fetch = mysql_fetch_array($results)) { $temp = $bestsellers_fetch['item_id']; $sql = "SELECT count(`user_id`) as response FROM `watch_list` where `item_id`=$temp group by `item_id`"; $res = mysql_query($sql); $response = mysql_fetch_row($res); $counttop = $counttop + 1; if (!empty($bestsellers_fetch['sub_title'])) $item_subtitle1 = $bestsellers_fetch['sub_title']; else $item_subtitle1 = substr($bestsellers_fetch['item_title'], 0, 20); $item_title1 = substr($bestsellers_fetch['item_title'], 0, 40) ?> <tr> <td class="tr_botborder" style="vertical-align:middle;" width="20%" align="center"><div align="center"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><img src="thumbnail/<?= $bestsellers_fetch['picture1']; ?>" alt="" width="79" height="70" border="0" /></a></div></td> <td class="tr_botborder" style="vertical-align:middle;" width="30%" align="center"><div align="center"><span class="bestsellerstxt"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><?= $item_subtitle1; ?> <?= $item_title1; ?></a><br/><?php if ($response[0] != '') { ?><a style="text-decoration:none;color:#336666;" href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>"> <?php echo $response[0] . '&nbsp;responses'; ?></a> <?php } else { ?><span style="color:#666666;"><?php echo '0&nbsp;responses'; } ?></span></span></td> <td class="tr_botborder" style="vertical-align:middle;" width="50%" align="center"><div align="center"><span class="bestsellerstxt"><a href="#" class="bestsellerstxt"><?= html_entity_decode($bestsellers_fetch['detailed_descrip']); ?></a></span></td> </tr> <? if ($counttop != 2) { } } } else { ?> <tr><td height="148" align="center" class="featxt">No Items Available</td></tr> <? } ?> </table> <div style="text-align: right;"><?php echo $nav_links; ?></div> в <?php include("include/connect.php"); include("library/paginator.php"); ?> <div style="text-align:right;"> <? $query = "select * from settings"; $tab = mysql_query($query); $row = mysql_fetch_array($tab); $item_no = $row['items_to_show']; $scroll = $row['scroll_interval']; $online_paginate = new Paginator; $online_paginate->sql = "select * from recent_updates where status='Active' and picture1!='' and selling_method!='want_it_now' and selling_method!='ads' and bid_starting_date <= now() and expire_date>=now() order by item_id desc"; // sql statement $online_paginate->rows_on_page = $item_no; $results = $online_paginate->get_page_result(); // result set $num_rows = $online_paginate->get_page_num_rows(); // number of records in result set $nav_links = $online_paginate->navigation("&nbsp; | &nbsp;"); // the navigation links (define a CSS class ?> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#d79196" class="detail9txt"> <input type="hidden" value="2" name="len"> <td align="center" width="20%"><b>Picture</b> </td> <td width="30%" align="center"><b>Name / Responses</b> </td> <td width="50%" align="center"><b>Description</b> </td> </tr><tr style="height:10px;"><td></td></tr> <? if ($num_rows > 0) { while ($bestsellers_fetch = mysql_fetch_array($results)) { $temp = $bestsellers_fetch['item_id']; $sql = "SELECT count(`user_id`) as response FROM `watch_list` where `item_id`=$temp group by `item_id`"; $res = mysql_query($sql); $response = mysql_fetch_row($res); $counttop = $counttop + 1; if (!empty($bestsellers_fetch['sub_title'])) $item_subtitle1 = $bestsellers_fetch['sub_title']; else $item_subtitle1 = substr($bestsellers_fetch['item_title'], 0, 20); $item_title1 = substr($bestsellers_fetch['item_title'], 0, 40) ?> <tr> <td class="tr_botborder" style="vertical-align:middle;" width="20%" align="center"><div align="center"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><img src="thumbnail/<?= $bestsellers_fetch['picture1']; ?>" alt="" width="79" height="70" border="0" /></a></div></td> <td class="tr_botborder" style="vertical-align:middle;" width="30%" align="center"><div align="center"><span class="bestsellerstxt"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><?= $item_subtitle1; ?> <?= $item_title1; ?></a><br/><?php if ($response[0] != '') { ?><a style="text-decoration:none;color:#336666;" href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>"> <?php echo $response[0] . '&nbsp;responses'; ?></a> <?php } else { ?><span style="color:#666666;"><?php echo '0&nbsp;responses'; } ?></span></span></td> <td class="tr_botborder" style="vertical-align:middle;" width="50%" align="center"><div align="center"><span class="bestsellerstxt"><a href="#" class="bestsellerstxt"><?= html_entity_decode($bestsellers_fetch['detailed_descrip']); ?></a></span></td> </tr> <? if ($counttop != 2) { } } } else { ?> <tr><td height="148" align="center" class="featxt">No Items Available</td></tr> <? } ?> </table> <div style="text-align: right;"><?php echo $nav_links; ?></div> в <?php include("include/connect.php"); include("library/paginator.php"); ?> <div style="text-align:right;"> <? $query = "select * from settings"; $tab = mysql_query($query); $row = mysql_fetch_array($tab); $item_no = $row['items_to_show']; $scroll = $row['scroll_interval']; $online_paginate = new Paginator; $online_paginate->sql = "select * from recent_updates where status='Active' and picture1!='' and selling_method!='want_it_now' and selling_method!='ads' and bid_starting_date <= now() and expire_date>=now() order by item_id desc"; // sql statement $online_paginate->rows_on_page = $item_no; $results = $online_paginate->get_page_result(); // result set $num_rows = $online_paginate->get_page_num_rows(); // number of records in result set $nav_links = $online_paginate->navigation("&nbsp; | &nbsp;"); // the navigation links (define a CSS class ?> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#d79196" class="detail9txt"> <input type="hidden" value="2" name="len"> <td align="center" width="20%"><b>Picture</b> </td> <td width="30%" align="center"><b>Name / Responses</b> </td> <td width="50%" align="center"><b>Description</b> </td> </tr><tr style="height:10px;"><td></td></tr> <? if ($num_rows > 0) { while ($bestsellers_fetch = mysql_fetch_array($results)) { $temp = $bestsellers_fetch['item_id']; $sql = "SELECT count(`user_id`) as response FROM `watch_list` where `item_id`=$temp group by `item_id`"; $res = mysql_query($sql); $response = mysql_fetch_row($res); $counttop = $counttop + 1; if (!empty($bestsellers_fetch['sub_title'])) $item_subtitle1 = $bestsellers_fetch['sub_title']; else $item_subtitle1 = substr($bestsellers_fetch['item_title'], 0, 20); $item_title1 = substr($bestsellers_fetch['item_title'], 0, 40) ?> <tr> <td class="tr_botborder" style="vertical-align:middle;" width="20%" align="center"><div align="center"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><img src="thumbnail/<?= $bestsellers_fetch['picture1']; ?>" alt="" width="79" height="70" border="0" /></a></div></td> <td class="tr_botborder" style="vertical-align:middle;" width="30%" align="center"><div align="center"><span class="bestsellerstxt"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><?= $item_subtitle1; ?> <?= $item_title1; ?></a><br/><?php if ($response[0] != '') { ?><a style="text-decoration:none;color:#336666;" href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>"> <?php echo $response[0] . '&nbsp;responses'; ?></a> <?php } else { ?><span style="color:#666666;"><?php echo '0&nbsp;responses'; } ?></span></span></td> <td class="tr_botborder" style="vertical-align:middle;" width="50%" align="center"><div align="center"><span class="bestsellerstxt"><a href="#" class="bestsellerstxt"><?= html_entity_decode($bestsellers_fetch['detailed_descrip']); ?></a></span></td> </tr> <? if ($counttop != 2) { } } } else { ?> <tr><td height="148" align="center" class="featxt">No Items Available</td></tr> <? } ?> </table> <div style="text-align: right;"><?php echo $nav_links; ?></div> в <?php include("include/connect.php"); include("library/paginator.php"); ?> <div style="text-align:right;"> <? $query = "select * from settings"; $tab = mysql_query($query); $row = mysql_fetch_array($tab); $item_no = $row['items_to_show']; $scroll = $row['scroll_interval']; $online_paginate = new Paginator; $online_paginate->sql = "select * from recent_updates where status='Active' and picture1!='' and selling_method!='want_it_now' and selling_method!='ads' and bid_starting_date <= now() and expire_date>=now() order by item_id desc"; // sql statement $online_paginate->rows_on_page = $item_no; $results = $online_paginate->get_page_result(); // result set $num_rows = $online_paginate->get_page_num_rows(); // number of records in result set $nav_links = $online_paginate->navigation("&nbsp; | &nbsp;"); // the navigation links (define a CSS class ?> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr bgcolor="#d79196" class="detail9txt"> <input type="hidden" value="2" name="len"> <td align="center" width="20%"><b>Picture</b> </td> <td width="30%" align="center"><b>Name / Responses</b> </td> <td width="50%" align="center"><b>Description</b> </td> </tr><tr style="height:10px;"><td></td></tr> <? if ($num_rows > 0) { while ($bestsellers_fetch = mysql_fetch_array($results)) { $temp = $bestsellers_fetch['item_id']; $sql = "SELECT count(`user_id`) as response FROM `watch_list` where `item_id`=$temp group by `item_id`"; $res = mysql_query($sql); $response = mysql_fetch_row($res); $counttop = $counttop + 1; if (!empty($bestsellers_fetch['sub_title'])) $item_subtitle1 = $bestsellers_fetch['sub_title']; else $item_subtitle1 = substr($bestsellers_fetch['item_title'], 0, 20); $item_title1 = substr($bestsellers_fetch['item_title'], 0, 40) ?> <tr> <td class="tr_botborder" style="vertical-align:middle;" width="20%" align="center"><div align="center"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><img src="thumbnail/<?= $bestsellers_fetch['picture1']; ?>" alt="" width="79" height="70" border="0" /></a></div></td> <td class="tr_botborder" style="vertical-align:middle;" width="30%" align="center"><div align="center"><span class="bestsellerstxt"><a href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>" class="bestsellerstxt"><?= $item_subtitle1; ?> <?= $item_title1; ?></a><br/><?php if ($response[0] != '') { ?><a style="text-decoration:none;color:#336666;" href="detail.php?item_id=<?= $bestsellers_fetch['item_id']; ?>"> <?php echo $response[0] . '&nbsp;responses'; ?></a> <?php } else { ?><span style="color:#666666;"><?php echo '0&nbsp;responses'; } ?></span></span></td> <td class="tr_botborder" style="vertical-align:middle;" width="50%" align="center"><div align="center"><span class="bestsellerstxt"><a href="#" class="bestsellerstxt"><?= html_entity_decode($bestsellers_fetch['detailed_descrip']); ?></a></span></td> </tr> <? if ($counttop != 2) { } } } else { ?> <tr><td height="148" align="center" class="featxt">No Items Available</td></tr> <? } ?> </table> <div style="text-align: right;"><?php echo $nav_links; ?></div> 

Этот код отлично работает во всех браузерах, кроме IE. Когда я перехожу на страницу на моем ie9 и ничего не делаю после нескольких (5-8) минут, страница просто пуста.

Related of "Перезагрузите содержимое div afer регулярного промежутка времени"

Я прошел через это … На самом деле Ошибка загрузки, потому что IE строго проверяет возвращаемый HTML. поэтому убедитесь, что Recent_updates.php возвращает допустимый html

Я не уверен в IE9, но у меня был этот тип проблем в более старых версиях IE. У этого браузера есть плохая привычка открывать постоянные соединения с сервером, и большинство серверов (если не все) имеют ограничение в количестве открытых подключений для каждого пользователя. Зная, что у вас есть интервал в 1 мин, и что постоянный тайм-аут соединения через 5 минут, просто считайте, и вы видите, почему …