How refresh dashboard only when a new record is inserted on db table

Hi all,
I got a dashboard that monitor all entries and I need to refresh it everytime a barcode reader inserts a new record on the “tubes” mysql table.
At the moment I do the refresh every 2 seconds and believe it’s very ugly to watch !!!
I need to find the way to refresh the screen only when a new record is inserted but I really don’t know where to start.
I know that jquey and ajax can do something like this but it’s really hard for me to find how.
Anybody there is able to make an easy sample to adapt to my needing ?
Many thanks

Video link :

Hi, I did a blank app that check for new records .
$sql_results = ‘SELECT mytimestamp FROM tubes WHERE mytimestamp >= DATE_SUB(NOW(), INTERVAL 2 SECOND)’ ;
sc_select(dataset, $sql_results);
$timefound = {dataset} ;

if (false == {dataset})
echo “ERROR”;
elseif ({dataset}->EOF)
echo “NO RECORDS”;
echo “NEW RECORD”;

but now I don’t know how to check it within grid every 1/2 seconds… and then … if NEW RECORD do the refresh of grid …

The big question is; what’s going to be the trigger. The MySQL insertion, or barcode scan action, could be the thing that triggers the next move. Or, there could be something that periodically checks if there’s any action. It’s either push or pull. Yet, due to the nature of browsers most push actions are just periodic pulls, just with very little data involved. You could have a blank page included into your dashboard that has got all the things you want it to do once a new barcode is scanned; that invokes periodic ajax call to a 2nd blank page that simply checks the auto-incremented ID of a barcode scan against the previous one. Matter of a few bytes swapped, could run few times a second if needed.

The thing with async/ajax calls it that is look/sounds kind of difficult, but it’s actually simple as heck. It took me about 5 minutes to make my first ajax/api thingie in Scriptcase. Especially with SC handling the $_GET / $_POST injection issues, it’s a breeze. jQuery is already included, only thing you need is a little research in callback functions and Bob’s your uncle. Unless Mike already is.

4give me…but queriest i think was asking on insert event…not refresh after few seconds…

i also looking to reload right iframe and left iframe after my user clicks add with newly inserted record.