Chapter 8: Editing the Calendar with AJAX and jQuery .......................................263 Opening the Event Creation Form ..................................................................................263
Adding an AJAX Call to Load the Form ................................................................................................. 264
Modifying the AJAX Processing File to Load the Form......................................................................... 265
Making the Cancel Button Behave Like the Close Button..................................................................... 268
Saving New Events in the Database ..............................................................................269
Modifying the AJAX Processing File to Handle New Submissions ....................................................... 271
Adding Events Without Refreshing ................................................................................273
Deserializing the Form Data ................................................................................................................. 274
Creating Date Objects........................................................................................................................... 279
Appending the Event to the Calendar ................................................................................................... 283
Getting the New Event’s ID................................................................................................................... 286
Editing Events in a Modal Window.................................................................................290
Determining the Form Action................................................................................................................ 291
Storing the Event ID if One Exists ......................................................................................................... 292
Remove Event Data from the Modal Window ....................................................................................... 294
Ensuring Only New Events Are Added to the Calendar......................................................................... 296
Confirming Deletion in a Modal Window........................................................................298
Displaying the Confirmation Dialog ...................................................................................................... 298
Configuring the Form Submission Event Handler for Deletion ............................................................. 301
Remove the Event from the Calendar After Deletion ............................................................................ 304
Summary .......................................................................................................................307
■