View Full Version : Ajax Form Question - Reacting to New Data?

03-12-2009, 04:46 PM
Hi all,

I want to have a form that sends data to a server each time a form control is blurred. This part I know how to do.

But another user will be watching the data that comes through. How can I get the other user's page to react to changes in the data (like what technologies should I be using)? The goal is an Ajax/page-refresh-less experience on both ends.


03-12-2009, 07:32 PM
ok so you know how to send the data via ajax. now there should be a php script that writes the data to either a file or database. then the 2 person should have a page where ajax goes to a php page that retrieves the data saved. the ajax should run every 5 seconds or so using a timeout or interval.

03-13-2009, 12:15 AM
Thanks for your reply.

Is using a timed retrieval the only way to check for new data? I was hoping there would be some way for person 2 to have some kind of constant connection to the server. Now that I think about it, I guess what I'm looking for is closer to some sort of rudimentary P2P technology.

If that tech is out there, I don't need a guide on how to use it - just need to know what tools are needed to accomplish this.

03-13-2009, 12:41 AM
The only way to use p2p is through additional software, like http://blog.peeraware.com/2008/05/04/writing-p2p-programs-in-javascript-and-html/. I think a timed retrieval is a good method for what you want, almost like an ajax chat script, but ultimately it is up to you.

03-13-2009, 03:57 AM
Doh! I wouldn't have thought to look for chat scripts, thank you! :)

03-13-2009, 11:01 AM
You're Welcome :)