title: Saving Backbone.js model data. Data not sent correctly
body: <p>I'm new to Backbone.js and I'm trying to save a model instance.
  I'm using django as my server.</p>
  
  <p>Client side Code:</p>
  
  <pre><code>var Song = Backbone.Model.extend({
      defaults: {
          name: 'New Song'
      },
      url: function() {
          return window.location.href;
      }
  
  });
  
  var song = new Song()
  song.save()
  </code></pre>
  
  <p><code>csrfmiddlewaretoken</code> is set properly before the data is sent.</p>
  
  <p>I stepped through the jQuery $.ajax function called internally by 
  Backbone.sync and found that the model object contains the correct data.</p>
  
  <p>However, the <code>request.POST</code> received by the server is </p>
  
  <pre><code>POST:&lt;QueryDict: {u'[object Object]': [u'']}&gt;
  </code></pre>
  
  <p>instead of the actual data. Any idea where I'm going wrong?</p>
  
  <p><strong>Update:</strong> I did a quick fix by setting <code>Backbone.emulateJSON</code> to true. But according to the comments in the Backbone (0.9.2) code it is meant for legacy servers. I'm using Django 1.4.1. Does it mean django 1.4.1 is incompatible? </p>
  
  <p><strong>Update 2</strong>: When I set <code>Backbone.emulateJSON</code> to <code>false</code>, I get the following error in firefox but it fails silently in chrome.</p>
  
  <pre><code>   "[Exception... "Component returned failure code: 0x80460001 
  (NS_ERROR_CANNOT_CONVERT_DATA)"  nsresult: "0x80460001 (NS_ERROR_CANNOT_CONVERT_DATA)"
  
    location: "JS frame :: http://localhost:8000/static/jquery.js :: &lt;TOP_LEVEL&gt; :: line 8214"  data: no]"
  </code></pre>
  
  <p>I'm using jQuery for ajax as preferred by Backbone and it seems the error might be in jQuery.</p>
  
  <p><strong>Update 3</strong>: I solved it by overriding the $.ajax used by Backbone.sync with my own. It is still a quick fix.</p>
  
  <p>Backbone.js verson: 0.9.2</p>
  
  <p>jQuery version: 1.8.0. Also tried with 1.7.2. Same result.</p>