|
If you've read anything about Ajax lately you've probably heard it's the next big thing. Everyone seems to interpret Ajax as this incredible framework for web development that should simplify our lives. The reality is there's no framework at all and it's simply a transport mechanism to send data to the server and back, all without a page refresh. It's all about the user experience here. Ajax enables developers to build applications that are extremely user-friendly and appear to behave similar to desktop applications. A good example of this is Google Maps.
Ajax has been around since 1998 and if you've done any Flash development you'll know that sending/loading data behind the scenes is old school. Flash gives us unlimited capabilities with LoadVariables, XML objects, Web Services, and Flash Remoting. All of these approaches enable developers to load data from a remote location without the need for a page refresh. This is HUGE because it minimizes the amount of data that is sent to and from the server and decreases the amount of time the user has to wait. As Ajax adoption grows I believe we'll start seeing some incredible UI components similar to what Flash offers. There's already some powerful technology becoming available in the server market and a great example is WebORB.
With all this being said I was blown away by the support for Ajax integrated into Ruby on Rails. It actually isolates the developer from having to write any low-level code such as dealing with XMLHTTPRequest directly. I'm fascinated by Ruby on Rails, but let me take a step back and give an example using ColdFusion. I've always loved ColdFusion because of the simplicity and it's where I started on this mad web journey back in '98!
This basic example demonstrates how to make a remote call to a .cfm that returns an IP address. The IP address is wrapped in a simple xml tag and returned to the client. The response looks like:
<result>127.0.0.1</result>
When the result handler receives the response it populates the text field with the client's ip address. This is all done asynchronously (can be made synchronous) which, in my opinion, improves the user experience. To sum it up this means the user does not have to wait for the response and can perform other operations while waiting. I encourage you to run the example and view the source to see how easy it is. Stay tuned for more Ajax adventures, but from an ROR perspective.
Posted by dennis baldwin at August 21, 2005 08:42 PM