仅刷新php中的div [英] Refresh only a div in php
本文介绍了仅刷新php中的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个聊天框,我想更新:-)但是我只想刷新div,而不是刷新页面...有人可以帮助我吗?
I have a chat box that i want to update :-) But I want only to refresh the div and not the hole page... Can someone help me??
代码:
<div align="right" id="chat">
<?php
include 'Chat.php';
?>
</div>
推荐答案
您无法使用服务器端脚本(例如 php
You can't do it with a server side script like php
但是,当需要更新div时,请使用jQuery.只需使用
However, Using jQuery, when you need to update the div. Simply use
$("#chat").load("Chat.php");
例如,当用户在文本框中输入完内容后,向服务器发出请求,并加载最近的聊天文本.
For an example, make a request to the server when a user finishes typing on a textbox, and load the recent chat text.
$("#textbox").change(function() {
$("#chat").load("Chat.php");
});
这篇关于仅刷新php中的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文