I also don't know how to ask google about this task
But I can direct you, I give you an algorithm.
1. You need daemon at your server. It could be PHP daemon.
2. This daemon must receive your request to start that lengthy procedure and start it.
3. Daemon answers to browser that it has started your task.
4. Your JS script will periodically ask (via AJAX) that daemon about the state of the task.
5. While in process it returns one state, when finished it returns another state.
You may use ajax or WebSocket to connect JS script and server. The second one, I think, is preferrable for this task, because server can send to the browser any information without additional requests.