I have a table populated by MySQL data. Every 5 seconds, that table is refreshed on a php page with my grab_data() function (AJAX). Sometimes I want to insert or delete entries. I do this using insert() or delete(), respectively. However, those changes aren't reflected until grab_data() refreshes. This can take up to 5 seconds, and I don't like the lag. I feel that having a shorter refresh period is not the way to go. Is there a better way to refresh grab_data() ie only when it's called rather than every so many seconds?