Keeping this mindset, I encourage you try liveview in any language of your choice [1].
This approach allows you to handle business logics on the server, and update the screen in browser from the server as well.
[1] https://github.com/liveviews/liveviews