This is called “short-polling”, and is a fairly common technique. (It used to be extremely common before websockets stabilized as a sufficiently-stable tool.)
Depending upon your deployment environment and the number of concurrent users, you may not even need to wait 5 seconds. Last time I created a short-polling interface, I think it was for about 20 users and they were polling at 1-second intervals.