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

Posted on 2011-02-15
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.
Question by:Bandai2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 82

Expert Comment

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


Author Comment

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?

Expert Comment

ID: 34899553
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.


Expert Comment

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.
LVL 82

Accepted Solution

leakim971 earned 500 total points
ID: 34899639
The term is << pulling >>, check this (HTTP Pull) :
At the opposite, << pushing >> same page (Reverse AJAX)

you have good info on the page.
setInterval on the client :
comet and ajax push on the server : and
LVL 11

Expert Comment

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

734 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