This section shows some code examples that I’ve implemented using information from various sources, using the Ruby on Rails framework and AJAX (to chuck around some buzzwords carelessly). It seems to be a nice simple but empowering combination but I’m far from an expert on the Ruby language, being more of a Java/C#/SQL guy professionally. I’m getting into it more and attempting more non-trivial things.
This example illustrates rails and the scriptaculous javascript library to create a <div> and <li> based sortable list. The moving of the list panels causes a call to be made to the server passing a message representing the new ordering. This is processed on the server and communicated back to the browser via XMLHttpRequest, calling a javascript callback to update the <div> with the new ordering. And extremely easy to implement using this framework.
MySQL database-driven interface for editing a one-to-many entity relationship with validation and business logic thrown in virtually for free.
Simple examples of AJAX doing in page replacement of content. Once again, form data is sent to the server as part of a XMLHttpRequest call and the server responds with the time in example one, or the form data in example two. A callback javascript function inserts the content into the page without a full page refresh.