A Backbone.js Playground

a playground setup with includes of backbone, jquery, underscore,...

by fguillen

HTML

<script src="http://documentcloud.github.com/underscore/underscore.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone.js"></script>

JavaScript

var data = '{"websiteID":"2","title":"titre site 2"}';

var Website = Backbone.Model.extend({
    // set default json data in the website:
    defaults: {"websiteID":"1","title":"default title"}
});

var website = new Website();

console.log( "1", website.toJSON() );
website.set( data );
console.log( "2", website.toJSON() );