localStorage到MySQL

Is there any easy way to move data from localStorage or sessionStorage into a MySQL database with callbacks?

I'm guessing this would be done with AJAX, but I can't find a good how-to or guide for it. Basically, I'd like to send localStorage to the server, and alert the user as to whether or not the data was successfully stored by the server into MySQL.

It's been a while since I messed around with this, but localStorage is basically just an object, right? Which means that it could be sent as JSON? So you could construct an AJAX call to a PHP page, send the JSON, and then (after the PHP has messed with it and tried to insert it and echoed the result) alert the user as to what happened, right?

(Obviously, you could do this with any server-side language.)