I'm working to create a "sandbox" of sorts, where numerous users will login and create draggable "nodes" on their own "sandbox." I'd love to be able to have the app auto-save after every modification, but first things first--I'm trying to get my Javascript objects stored in MySQL.
I'm new to Javascript, PHP and MySQL, but JSON seems to be my best friend for this task. Here's a rough example of a node:
node1.pos
node1.name
node1.content
node1.siblings
*Note: The actual node will house many more attributes, some with potentially sensitive information.
My goal is to have each node manipulated by the user (dragged, linked to siblings, name change, etc.) and then upon re-visiting the page, the "sandbox" re-populates with the nodes in the correct position, with all the correct data associated with it.
I think I can handle the function that will populate the canvas, but shifting the object between MySQL and Javascript is what confuses me. Will the object having methods cause any problems?
Does anyone have any help, advice or reference material that could help me out?
dataPacket
. With the code I posted for the load.php service, if the server returns a string, jQuery will parse it as JSON automatically (only if it's valid JSON) and you'll end-up with a JavaScript object. – Trinidad Jan 29 '11 at 4:15