title: jQuery ajax request not triggering JS response from rails controller?
body: <p>I have a standard controller which is set up to respond to HTML, JS and JSON requests:</p>
  
  <pre><code>def picture
    @picture = Picture.new params[:picture]
  
    respond_to do |format|
      if @picture.save
        format.html do
          logger.debug "In the HTML responder"
          redirect_to @picture
        end
        format.json { render json: @picture, status: :created, location: @picture }
        format.js { render :nothing =&gt; true }
      else
        # you get the idea
      end
    end
  end
  </code></pre>
  
  <p>Now I'm trying to send a request to that controller with the <code>$.ajax</code> function (I can't use <code>:remote =&gt; true</code> in this specific situation - I'm trying to make ajax file upload work).</p>
  
  <pre><code>$.ajax({
    url: $("form#new_picture").attr("action"),
    type: "POST",
    data: formdata,
    processData: false,
    contentType: false
  });
  </code></pre>
  
  <p>The problem is that my request is being treated as a HTML request for some reason. How do I tell rails that I want a JS response?</p>
  
  <p>By the way, I'm using jquery_ujs in my project so I have access to the methods it provides if necessary. I'm not really good enough at JS to tweak that to do what I need here.</p>