Solved

Gmail inbox auto update, is this AJAX? How could I do this?

Posted on 2011-02-15
6
970 Views
Last Modified: 2012-05-11
In Gmail once you received a new email it will update your inbox page with the new email without you reloading the page. How is Gmail doing this? How does Gmail knows I have a new email? From what I know AJAX only works if there's an action from a user, is this correct?

Please provide a sample code / a link to a tutorial on how I could do this.
0
Comment
Question by:Bandai2
6 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 34899328
different method if you're trying to do this using IMAP, POP or HTTP

>From what I know AJAX only works if there's an action from a user, is this correct?
No, you can do an ajax call using a timer, at page load and so on

0
 

Author Comment

by:Bandai2
ID: 34899548
>different method if you're trying to do this using IMAP, POP or HTTP

I should have been more clear, I'm not doing this to access emails. I just want the functionality of Gmail where it knows there is new data for the inbox. In my case instead of emails, my data would come from the database. I need to update the page as soon as there is new data saved on the database.


>No, you can do an ajax call using a timer, at page load and so on

Isn't this a resource heavy solution for the user? Is this how Gmail is doing it? A non stop timer?
0
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34899553
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34899571
My response was very terse I hit submit before explaining it. So much of the GMAIL functionallity is exposed to developers through Google API where you can get into the code of nearly everything Google has. If you follow my link and start searching and exploring in there you will find everything you need.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34899639
The term is << pulling >>, check this (HTTP Pull) : http://www.infoq.com/news/2007/07/pushvspull
At the opposite, << pushing >> same page (Reverse AJAX)

you have good info on the page.
setInterval on the client : http://www.w3schools.com/jsref/met_win_setinterval.asp
comet and ajax push on the server : http://www.ape-project.org/ and http://en.wikipedia.org/wiki/Comet_(programming)
0
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
ID: 34904122
Hi, You have to use the ajax control like update panel, and set its target control to refresh button. It is working like gmail inbox. Try this otherwise I will give you a video tutorials for ajax. ok
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now