I’ve recently had the opportunity to learn more about AJAX. For those unfamiliar with the term, it’s a web technique whereby web pages can make asynchronous calls to backend services to present functionality to the user without having to refresh the page all the time. I did this while developing functionality for my latest WordPress plugin: WP Auctions; a plugin that lets you run auctions fee free on your blog. (It’s running in the sidebar if you want to take a look)
The plugin makes extensive use of the Prototype Javascript framework which is a toolkit that provides a number of Javascript functions which work across multiple browsers. The function I used most was the Ajax.Request function that handles all the communication between browser and server. The popup functionality which comes into place when you click the “Bid Now” button actually uses 3 discrete AJAX functions to build up the screen, one to show the auction details, one to display bids on it and the other to display other auctions in the popup. There’s also another AJAX function that lets users bid on an auction. This means that users can perform any function they need without having to refresh the page or leave the website. Cool huh?
The main thing to remember with AJAX is never to rely on front-end validation for user input. An AJAX request can come from anywhere on the web; and there’s no guarantee that it’s coming from your code. So never assume, always validate .. it’s safer in the long run.
btw, if you want an invitation to the beta test, click here.