Wednesday, March 16th, 2005p>David Heinemeier Hansson and Jamis Buck, are putting Ajax-aware components into Rails.
Jamis is talking about whether to sync, or not to sync….
One of the great benefits to XMLHttpRequest is the fact that you can do work asynchronously. If you can possibly make your UI so it doesn’t ‘hang’, you should do so. However, if you really NEED to block on something for a good reason, then it makes sense to go that route. I normally try to work my UI to handle the asychronous use case as much as possible.
Although the following is easy:
element.innerHTML = submit_request(“/some/action?value=foo”)
If possible, I would really want to make sure that we don’t equate “this is easy” with “this is what we should do”.
Rails simple approach
It looks like Rails is going to have a very simple approach to adding Ajaxian components. The approach marries the world of partials in Rails, and returning arbitary HTML from the server-side, and having the client code
This covers the 80/20 rule, and gives Rails developers a very simple interface. It also has the benefit of bypassing the pain of the DOM.
There is more though…
While I like having this tactic as PART of the solution, I do also want to see a common set of XML parcels for other common tasks:
- dom-remove: Given an id, nuke it from the DOM
- dom-replace: Given an id, and new content, do a replace
- dom-insert: …
as well as the generic solutions such as:
- Put this HTML at this point
Posted by Dion Almaer at 12:36 am