How to delay sending a response from the server MySQL

There is a JavaScript Function (AJAX), sending data and request to the server every second, data from the table is sequentially displayed in response. How to delay sending a response from the server, for example, to set any timeout so that the answer is not sent until the script is waiting for at least one new entry in the table.
In general, you need to delay the answer from the server for 25 seconds for example …
I tried the function Sleep (), but is there anything suitable?
Thank you.

Answer 1, Authority 100%

In your case, dig it in the direction of comet .
If lazy or not the opportunity to understand, I advise you to put a delay between queries of seconds 20 and return only new data.

Answer 2

And what did Sleep fit? You can make a sample number of count records from the table, and check the specified time interval if Count has changed / increased data. To do this, you can use the same SLEEP