This example uses a bookmarks service, which saves data in the current PHP session.

When you make changes to active data objects, Jitsu automatically sends those changes back to the server.

For this tour, we've turned on JSON message debugging - after you make some edits, try opening the inspector and you will see JSON messages from the server in the console area.

For example, if you select two items and hit delete, the following message is sent over the wire:

{
    "dataSet":"bookmarks",
    "commands":[
        {
            "op":"remove",
            "path":["bookmarks"],
            "index":0,
            "aref":"b1"
        },{
            "op":"remove",
            "path":["bookmarks"],
            "index":0,
            "aref":"b2"
        },
        {
            "op":"load",
            "path":["bookmarks"]
        }
    ]
}

The data service responds by deleting the two objects and then sending the new version of the dataset back to the client. Jitsu then merges the changes into the page and updates the user interface.

When you add a new bookmark, then Jitsu sends the server a message like:

{
    "dataSet":"bookmarks",
    "commands":[
        {
            "op":"add",
            "path":["bookmarks"],
            "val":{
                "jsType":"Bookmark",
                "aref":"tmp11512962893431",
                "title":"New Bookmark 1",
                "url":"http://www.attap.com"
            },
            "index":0
        }
    ]
}

Finally, if you edit a bookmark, Jitsu sends a message like:

{
    "dataSet":"bookmarks",
    "commands":[
        {
            "op":"set",
            "path":["bookmarks","b5"],
            "key":"title",
            "val":"I edited the title"
        }
        {
            "op":"set",
            "path":["bookmarks","b5"],
            "key":"url",
            "val":"http://www.jitsu.org"
        }
    ]
}