Display spinner while waiting for post result. Also, structure javascript better.