title: Error: ActionController::Unknown Format (for format.js)
body: <p>I'm completing a project. I have a search field that accepts a url. Upon submit, my code scrapes data from a website and saves it in a variable. I want to use that data to automatically fill in form fields for the user on that same page. </p>
  
  <p>Here's what I currently have in the view: </p>
  
  <pre><code>&lt;%= provide(:title, "New Deal") %&gt;
  &lt;h3 class="create"&gt;Step 1: &lt;span class="text"&gt;Enter the wholesale URL and click add button to create a new deal.&lt;/span&gt;&lt;/h3&gt;
  &lt;%= form_tag new_deal_path, id: "search-form", method: :get do %&gt;
  &lt;p&gt;
    &lt;%= label_tag(:search, "Enter the URL:") %&gt;
    &lt;%= text_field_tag :search, params[:search] %&gt;
    &lt;%= submit_tag "Add Deal", name: nil, class: "scrape-trigger", remote: true %&gt;
  &lt;/p&gt;
  &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Here's my controller action: </p>
  
  <pre><code>def new
    if params[:search]
      @response = Deal.search(params[:search])
      respond_to do |format|
        format.js
      end #currently, can't get this to work.
    end
  @deal = Deal.new
  @deal.orders.build
  @user = User.new
  end
  </code></pre>
  
  <p>And here is the form I want to fill: </p>
  
  <pre><code>&lt;div class="manual-deal"&gt;
  </code></pre>
  
    
      
  
  <pre><code>&lt;%= f.label :url %&gt;&lt;br&gt;
  &lt;%= f.url_field :url %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :title %&gt;&lt;br&gt;
  &lt;%= f.text_field :title %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :image %&gt;&lt;br&gt;
  &lt;%= f.file_field :image %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :retail_price_cents %&gt;&lt;br&gt;
  &lt;%= f.text_field :retail_price_cents %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :wholesale_price_cents %&gt;&lt;br&gt;
  &lt;%= f.text_field :wholesale_price_cents %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :minimum_bids %&gt;&lt;br&gt;
  &lt;%= f.number_field :minimum_bids %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :estimated_delivery %&gt;&lt;br&gt;
  &lt;%= f.date_field :estimated_delivery %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :delivery_method %&gt;&lt;br&gt;
  &lt;%= f.select :delivery_method, ['USPS', 'UPS', 'FedEX', 'Shyp', 'Local Pickup'] %&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;%= f.label :description %&gt;&lt;br&gt;
  &lt;%= f.text_area :description %&gt;&lt;br&gt;
  
  &lt;script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
          data-key="&lt;%= Rails.configuration.stripe[:publishable_key] %&gt;"
          data-description="Charge"
          data-amount="&lt;%=@deal.wholesale_price_cents%&gt;"&gt;
  &lt;/script&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p></p>
  
  <p>Following the advice on another question, I created a new.js.erb file in the view where I want this to happen. I thought I could fill the fields from there using: </p>
  
  <pre><code>function ready() {
    $('.scrape-trigger').on("click", function() {
     $('#deal_url').val(params[:search]);
     $('#deal_title').val(title);
     $('#deal_image').val(image);
     $('#deal_wholesale_price_cents').val(price_range);
     $('#deal_description').val(description);
   });
  };
  $(document).on('ready page:load', ready)
  </code></pre>
  
  <p>Not quite sure about this last part. Can someone point me in the right direction? I've been stuck on this for hours and haven't found a decent solution. I've found some other resources on Ajax, but nothing that works with what I need with this scraped data. </p>
  
  <p>Cheers.</p>