fake model response in backbone.js

backbone.js, json

Solution

Backbone.Model.extend({
  fetch: function(){
    var model = this;
    model.set({yourStatic: "Json Here"});
  }
}

This should work. From the Backbone documentation:

`fetch()`: Resets the model's state from the server by delegating to Backbone.sync

Problem

How can I fake a REST response in my model s.t. it does not really go to the service but returns a fixed json? If possible show me a version that does it with overriding sync() and a version that overrides fetch(). I failed with both so this will be a good education for as for the difference between them.

Original source