title: How do I PUT data to Rails using JQuery
body: <p>I am trying to send a jquery ajax PUT request that looks like this:</p>
  
  <pre><code>$.ajax({
            type: "PUT",
            url: '/admin/pages/1.json',
            data: { page : {...} },
            dataType: 'json',
            success: function(msg) {
              alert( "Data Saved: " + msg );
            }
  });
  </code></pre>
  
  <p>but I get the following error:</p>
  
  <pre><code>The error occurred while evaluating nil.name
      /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/xml_mini/rexml.rb:29:in `merge_element!'
      /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/xml_mini/rexml.rb:18:in `parse'
      (__DELEGATION__):2:in `__send__'
      (__DELEGATION__):2:in `parse'
      /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/hash/conversions.rb:154:in `from_xml' ... ...
  </code></pre>
  
  <p>Is like Rails is trying to parse the params as XML, but I want to use JSON!!</p>
  
  <p>What shall I do to put JSON to rails?</p>