I’m debating as to whether to use ajax to load parts of the page
asynchronously. It would make the view layouts much easier to work
with and result in less code. We have a lot of different widgets that
can get displayed in different combinations on different pages. Views
usually have forms that need to submit to various controllers. For
example say we have a user profile page. There are links and forms to
edit various types of content such as files, blogs, settings
information, etc… So we need to have forms that submit to any
number of different controllers yet keep the same view layout in place
regardless of what controller they are hitting. So far I’ve been
using some before filters to set the layout, using the referring url
to redirect back to, etc… It works but it could be a lot cleaner
My concern is the type of traffic this is going to put on our mongrel
clusters. The requests will be smaller and do less work, but I have a
feeling that the per request overhead is going to start adding up.
On the other hand I can see ajax making certain things easier to
scale. In most large apps I’ve worked on you eventually start to use
parallel requests to aggregators/caches of some type in the web app.
Ajax kind of gives this to you for free in a way, but I have no
experience actually implementing it on a large scale.