這是我的PHP code_
if(isset($_REQUEST['show']))
{
$con=mysqli_connect("localhost","root","","server_name");
$show = mysqli_query($con, "SELECT * FROM name1 ORDER BY date DESC");
$html='';
while($showE = mysqli_fetch_array($show))
{
$html.= '<h3>'.$showE['un_name'].'</h3>';
$html.= '<div>'.$showE['un_name_dec'].'</div>';
}
echo $html;
//End of while loop
}
這是jQuery的code_
$.post('preprocessor.php', '&show=', function(data) {
$("#accordion").html(data);
$("#accordion").accordion({
collapsible: true,
icons: {
activeHeader: "ui-icon-triangle-1-s",
header: "ui-icon-triangle-1-e"
}
});
});
這是body_
<div id='accordion'>
</div>
我我沒有得到實時更新,一切正常,但Ajax的東西沒有工作......它工作,如果我刷新或重新加載頁面,但不是自己
確保這裏http://api.jquery.com/event.preventDefault/ – elclanrs
你重複調用查詢code_檢查? –
是的它是一個循環 –