IS this "approval" the result of a payment gateway transaction? Is it external to your system? Just trying to fathom why it takes so long (30 seconds is an eternity in computer time 🙂
If it actually takes 10-30 seconds for your database to query the approval, then I suggest ramping up the script execution time on your php script. One easy trick I have seen in the past, is to show a hidden layer with a animated gif or animated flash when the user clicks the submit button. The animation can be a "progress bar" that just goes back and forth. The idea being that the user gets the reassuring gesture that the application has not become unresponsive.
If it's an external transaction and you are dependent upon a 3rd party, then you are on the right track with setInterval. That is, you could use setInterval() to continuously call a function that uses AJAX to call a php page that queries the database looking for the approval code.
Here is an example using setInterval().
However, this might be a little tricky with the ajax call mixed in. I have used Ajax.PeriodicalUpdater from the prototype javascript library in the past to do similar things. It uses setInterval() at it's core, I believe, to automatically call a remote page (your php page that queries for the existence of the approval, for example.) based on what the php page returns, you can decide to move on, etc.
Good luck!