dsfykqq3403 2012-05-06 15:48
浏览 8
已采纳

如何使用新数据重新加载php文件中的某个部分?

I have a php file which retrieves data from a MySql database and display it. But the database have more no of data say 100. But in my php file I have planned to display 6 at a time just by using

LIMIT start_value, 6.

Then at the bottom I have a pan which contains the following code

<a href="index.html?start_value=start_value+6">1</a>
<a href="index.html?start_value=start_value+12">2</a>
<a href="index.html?start_value=start_value+18">3</a>
<a href="index.html?start_value=start_value+24">4</a>
<a href="index.html?start_value=start_value+30">5</a>
<a href="index.html?start_value=start_value+36">6</a>

So now the issue is if anyone clicks the link above the whole index.html will be reloading which will be annoying. Is there any way to display the new data from the database just by reloading that particular DIV after clicking any of the links?

  • 写回答

3条回答 默认 最新

  • doucan8521 2012-05-06 15:57
    关注

    Is there any way to display the new data from the database just by reloading that particular DIV after clicking any of the links?

    Yes, there is. You need to use the XMLHttpRequest object and DOM. In one word: AJAX

    The best way is to use a framework like jQuery or Prototipe.

    Here you can find an example. You should replace the "latest_scores.html" page, in that example, with another page "latest_scores.php". The php script will create the refreshed content that can be placed inside your div.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端