title: Rails js.erb not working
body: <p>I'm submitting a form, with somewhat complex nesting to a Rails controller.  The Javascript is tied to the submit button as below:</p>
  
  <pre><code>    $('#new_search').submit(function() {  
      var valuesToSubmit = $(this).serializeArray();
      $.ajax({
          type: "POST",
          url: $(this).attr('action'), //sumbits it to the given url of the form
          data: valuesToSubmit,
          dataType: "POST" 
      })
      return false; // prevents normal behaviour
  });
  </code></pre>
  
  <p>The Rails controller handles this fine and the parameters are all where they should be.</p>
  
  <p>I'm then rendering a js.erb file: </p>
  
  <pre><code> respond_to do |format|
    format.js { render '/searches/update_search_results.js.erb' } 
   end
  </code></pre>
  
  <p>and the log shows this has indeed rendered:</p>
  
  <pre><code>Rendered searches/update_search_results.js.erb (0.3ms)
  </code></pre>
  
  <p>But in this file (I've doubled checked the file name) even a simple </p>
  
  <pre><code>alert("hello world");
  </code></pre>
  
  <p>is not firing.  There are no Javascript errors in the console log.  Anyone got any suggestions?  Something to do with the original Javascript that sends the Ajax request?
  thanks for any help</p>