title: Fetching Backbone Models from ExpressJS server
body: <p>I am having difficulty in creating a client-side Backbone model that upon initialization retrieves some XML from a ExpressJS server. When the Backbone model is created, an initialization function calls <code>model.fetch()</code> and passes in its model ID in the query string. The server should read the ID and return the correct XML.</p>
  
  <p>This currently isn't working (code below), when I debug in my browser, I can see the network request appears to be correct, for example the request could be <code>/biomodels?id=BIOMD0000000001</code>, but the request stays pending when it is initiated from Backbone.  </p>
  
  <p>However, If I use my browser (Chrome), and go to <code>/biomodels?id=BIOMD0000000001</code> then the model correctly is retrieved.</p>
  
  <p>Express server route handler:</p>
  
  <pre><code>/*global exports require*/
  exports.getModel = function (req, res) {
      // Dependencies
      var biomodels = require('biomodels').BioModelsWSClient;
      // Get SBML From ID
      console.log('requested ID: ' + req.query.id)
      console.log(biomodels.getModelSBMLById(req.query.id, function (err, results) {
          console.log(err + results);
          res.send(err + results);
      }));
  };
  </code></pre>
  
  <p>Backbone Model:</p>
  
  <pre><code>define([
      'underscore',
      'backbone'
  ], function (_, Backbone) {
      'use strict';
  
      var BioModel = Backbone.Model.extend({
          defaults: {
              sbml: 'was not fetched',
              id: 'was not assigned'
          },
  
          initialize: function () {
              var modelId = this.id,
                  modelSbml = this.sbml;
              this.fetch({
                  data: {
                      id: modelId
                  },
                  type: 'GET',
                  error: function (jqXHR, textStatus, errorThrown) {
                      console.log('error in GET: ' + textStatus + errorThrown);
                  },
                  url: 'biomodels',
                  success: function (data, textStatus, jqXHR) {
                      modelSbml = data;
                      console.log('loaded ' + modelSbml);
                  }
              });
          }
      });
  
      return BioModel;
  });
  </code></pre>