How to create an event listener across varied devices?

Posted on 2011-05-08
Medium Priority
Last Modified: 2013-11-11
I'm trying to submit a simple jQuery Mobile contact form on my iPhone then on my iPad be able to be notified in real time that the form has been submitted and show the new submission in a list.  So the iPhone is using the 'user' interface and the iPad is using the 'admin' interface of the same app.

I can have the iPad refresh the page every 30 seconds and then see the updated list that way but wanted it to be a real-time thing.  I just need a pointer in the right direction as can't get my head around how to do it.

I figure it must require an event listener or maybe a database trigger or something?  Not sure...am a noob to jQuery so learning as I go.  Any help greatly appreciated!! Thanks in advance :)
Question by:Zenturi0n
LVL 39

Accepted Solution

Aaron Tomosky earned 2000 total points
ID: 35715698
You can do a "persistent connection" but it's not usually recommended.
I'd suggest a JavaScript (Ajax) every one second that checks and does an innerhtml insert if it finds something. That way you are not refreshin the page, just doing a tiny query.

Author Comment

ID: 35718771
Thanks aarontomosky, appreciate it!  Got me on the right track.

For anyone interested I also found this helpful: http://stackoverflow.com/questions/4576769/grabbing-data-from-mysql-using-php-realtime

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question