title: Receiving 406 error making d3.json call to rails app
body: <p>I've got a web page trying to make a request to a rails app for json data using d3. For some reason, I keep getting a 406 error ('Not Acceptable') and within the controller, <code>request.content_type</code> is <code>nil</code> and <code>request.format</code> gives me:</p>
  
  <pre><code>#&lt;Mime::Type:0x00000002595c20 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html", @hash=4164709875014779265&gt;
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>The JavaScript</p>
  
  <pre><code>url = '/sources/data/' + $('#source_id').val() + '/' + $(this).val();
    return d3.json(url, function(d) {
      var color, format, height, pack, svg, width;
      console.log(d);
      //...do some stuff
  </code></pre>
  
  <p>The Controller:</p>
  
  <pre><code>class SourcesController &lt; ApplicationController
    before_action :set_source
  
    def get_data
    @count_data = Hash.new
    case params[:type].downcase
    when 'stems'
      @count_data =  JSON.parse @source.stem_cache
    when 'words'
      @count_data =  JSON.parse @source.word_cache
    when 'synonyms'
      @count_data =  JSON.parse @source.synonym_cache
    end
    puts "hello"
    respond_to do |format|
      format.json {render json: @count_data}
    end
  end
  </code></pre>