In this section we'll add an AJAX-enabled Dialog box that will let visitors rate either of the images. Using Dialog is very similar in many ways to using the Panel. The underlying markup for Dialog follows the same SMF, and the constructors are also very similar.
One of the benefits of Dialog over Panel is that you can send and receive data asynchronously between the Dialog and an application running on the server. This makes use of all of the AJAX facilities provided by the YUI with very little intervention from us.
We'll also write the PHP code that will carry out the rating request. Like the last time we looked at an AJAX application with the YUI, we need a full web server environment for this example to work correctly.
By the end of this section, we'll have something that looks like this:
We have added a series of buttons, one underneath each image to enable our visitors to rate each image. When pressing that button, a Dialog pops up that is perfectly aligned to the...