Recording Puzzle Information

Now that we have created a table to record our information, we need to work on saving data from the puzzle to it. Because we want this to feel like an application, we can take care of the posting of scores to the server with AJAX. Since we already have jQuery included for this project, this is a really simple refactor. As with any AJAX code, there are two pieces: the server-side code that processes the request and the client side that initiates it. I will start with the JavaScript to build the AJAX request and send it to the server and then implement the server side response.

Passing data in AJAX can be quite simple. For our purposes, I am creating a new object in the javascripts/puzzle.js file to hold the data the ...

Get Beginning Facebook Game Apps Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.