I currently have two divs, one that contains a search bar and one that contains a partial, as such:
<div class="search_div">
<%= form_tag(barpage_outings_path, :method => :get, :id => 'bars_search_form', :remote => true ) do %>
<div id="user_search" class="in-field">
<%= text_field_tag('search', '', :id => 'search_field') %>
<%= label_tag 'search_field', 'Search For Locations' %>
<%= submit_tag "", :id => "search_button" %>
</div>
<% end %>
</div>
<div id="bar_partial">
<%= render(:partial => "bar_results") %>
</div>
It renders a partial just fine upon page load, but I'd like it to refresh the partials contents after each search submission.
I have the form bound to an AJAX call, like such:
$('#bars_search_form').bind('ajax:success', function(){
$('#bar_partial').html("<%= escape_javascript(render(:partial => 'bar_results')).html_safe %>");
});
The problem is, instead of refreshing the partial, it just outputs my escape javascript command as plain text. Can anyone see what I'm doing wrong (or even if I'm going about this in the completely wrong way?)