This ideally should be handled in AJAX using promises, assuming the end user is using something that resembles a modern browser. I link jQuery's stuff here because that's what I use, but if you want to roll your own, I don't see what's stopping you.
Comment on Re: Update on controlling long-running processes via CGI