简体   繁体   English

当某些数据插入另一个php文件中时,使用ajax将内容加载到php页面的div中

[英]Load content in a div of a php page using ajax when some data is inserted in another php file

I have 2 php pages; 我有2个php页面; first is chat view page which is my global display page & the other page is one where i insert my data. 首先是聊天视图页面,这是我的全局显示页面,另一页面是我在其中插入数据的页面。 How do i load a that data in this page's div when i insert some text in another php file from my iPad application. 当我从iPad应用程序的另一个php文件中插入一些文本时,如何在该页面的div中加载该数据。 My problem is i need to refresh this page manually to load all the contents which isnt the right thing to do in a chat application. 我的问题是我需要手动刷新此页面以加载所有内容,而这在聊天应用程序中是不正确的。 As my chat view page has no event to load the div how do i do this. 由于我的聊天视图页面没有加载div的事件,我该怎么做。 Has some ajax or jquery logic behind this as far as i think. 据我认为,在此背后有一些ajax或jquery逻辑。

USE 采用

JQUERY .load JQUERY .load

Description: Load data from the server and place the returned HTML into the matched element. 描述:从服务器加载数据并将返回的HTML放入匹配的元素。

and $.ajax $ .ajax

Simply ajax won't be enough to do the thing what you want. 仅仅是ajax不足以完成您想要的事情。 This is actually opposite of ajax and called as comet programming where the server should make some events to notify the client which has new data. 这实际上与ajax相反,称为彗星编程 ,在这种编程中,服务器应发出一些事件以通知客户端有新数据。 Therefore the client should have some sort of interaction with the server to accomplish this. 因此,客户端应与服务器进行某种交互以完成此操作。 Few technology terms I can remember are 我能记住的技术术语很少

  1. long polling -- similar to normal polling but at lower frequency 长轮询 -与普通轮询类似,但频率较低
  2. server side events -- better explanation 服务器端事件 - 更好的解释
  3. web sockets -- explained , popular lib Web套接字 - 解释 流行的lib

hope I made it clear some sort 希望我能说清楚一点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM