Brian Elliott
Brian Elliott

Reputation: 51

AJAX PHP - Live Updates on Tables?

I'll start off with this - I only know the absolute basics of PHP so my knowledge within this is very limited.

I only just read up on AJAX last night and on what it does.

So essentially. I have lets say 3 tables - They are ALL in on How would I make the information update within that table when NEW information from another source comes in.

For example- I am on One Page viewing ALL the table information

You are on another Inserting a new row. You insert the new row.

I see it instantaneously without refreshing the page

And after that it simply continues to update.

I have absolutely no idea where to start with this as my knowledge of PHP and AJAX is rather limited, however I understand the concept of AJAX.

I've been looking for around 3hours for something that would help further understand how to do it, but most of it is related to searches and that kind of thing.

Upvotes: -2

Views: 2794

Answers (1)

Ahmad
Ahmad

Reputation: 5760

You have two ways:

1- Polling the server using AJAX, and requesting for new added items, if any and repeating this task every some seconds.

2- Using Server Sent Events, which keeps an active connection to the server, and when a new item added, it informs by triggering an event in the browser.

Read more about that: http://www.w3schools.com/html/html5_serversentevents.asp

Each one has advantages and disadvantages, first one is less heavy and a with a little delay, and the second one is more heavy, less supported and absolutely live. It depends on what you want to do.

Upvotes: 3

Related Questions