Models

AJAX Abstraction for a Single Resource

fetch

The fetch() method is used to retrieve a resource.

Usage

You can learn about how this method can be used to retrieve resources here.

Default Implementation

fetch: function(options) {
  options = _.extend({ parse: true }, options);

  // After a successful fetch, the model is updated with the server-side state.
  const model = this;
  options.success = function(attributes) {
    if (options.parse) {
      attributes = model.parse(attributes, options);
    }

    if (attributes && !model.set(attributes, options)) {
      return false;
    }
  };

  return this.sync('read', this, options);
},