02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

268<br />

CHAPTER 8 ■ EDITING THE CALENDAR WITH AJAX AND JQUERY<br />

Figure 8-1. The event creation form loaded in a modal window<br />

Making the Cancel Button Behave Like the Close Button<br />

You may have noticed that the modal window doesn’t contain a Close button when the form is<br />

displayed. However, the modal window does include a Cancel button that will refresh the page when<br />

clicked. Instead of adding more buttons to the window, you’re simply going to make the Cancel button<br />

call the fx.boxout() method to close the window.<br />

To accomplish this, use .live() to bind a click event h<strong>and</strong>ler to any link containing the word cancel<br />

inside a form with the edit-form class:<br />

<strong>jQuery</strong>(function($){<br />

var processFile = "assets/inc/ajax.inc.php",<br />

fx = {<br />

"initModal" : function() {...},

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!