简体   繁体   中英

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; 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. 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. Has some ajax or jquery logic behind this as far as i think.

USE

JQUERY .load

Description: Load data from the server and place the returned HTML into the matched element.

and $.ajax

Simply ajax won't be enough to do the thing what you want. 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. 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

hope I made it clear some sort

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.

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