At first, I thought being able to return json as responses from the server was pretty neat, with rjs (now js.erb) files using render :update call in Rails. However, this often lead to some messy code by me and my colleagues. I would see lots of client side code in the application controller like:
- Server response can be faster, since we wouldn't have to rely on the server to generate the proper html link. The UI effects and behavior can be all done on the client side, where it should be.
- I think it's a bit cleaner to be able to say things declaratively, more aligned with how html is declarative.
- The DOM elements wouldn't couple the controller and the view. Everything that refers to DOM elements would be in the view and be easier to change without cascading effects.
- You can work in the same level of abstraction while in the HTML views and won't have to jump between layers of abstraction.