how to update a table when new row in database like gmail

how to update a table when new row in database like gmail

Hi guys,

I got a page displaying subscriber's name, phone number and email. I need to update the table's row when there's a new record found in database.
Hence, I need to use a while loop (forever) to query backend database like every 2 seconds. Just like Gmail, you leave it there and when there's a new email, you will see it instantly update the table to the first row.

Anyone can advice on how to accomplish this using jQuery easily? I am not sure if Gmail is using push or pull method to get email updated in the table.

Thanks,
Mark