I have an auction site & want to refresh the item page for everyone when the new bid is posted. The item page is called item.php. What I was thinking was that when the new bid is posted to the database when the button clicks, the same click refreshes item.php. The code I'm looking at is
if (!isset($_POST['action']) && !isset($_GET['refresh'])) {
header("Location: /item.php?refresh");
}|| isset($errmsg))
The original code was
if (!isset($_POST['action']) || isset($errmsg))
but this is not working.
I'm wondering is there a simple onclick
solution I can add to the button in bid to refresh item.php for everyone. I also looked at AJAX but I don't understand how to apply it here. Any advice on the best solution to this is appreciated.
我建议将ajax调用以确定的时间间隔执行到服务器,以获取最新的出价,这样您就可以比较显示的出价是否为最新出价,然后根据需要刷新带有位置的页面。 reload();
You can achieve via using jquery load() method.
You have to call load() method every time when you insert new data.It will simply give all data without refresh page.
For example: $("#yourDiv").load("www.yourdomain.com/item.php).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.