I have a a sidebar that like this;
<div id = "sidebar-links">
<% @locations.each do |locs| %>
<p style = "border-bottom: 1px black solid">
<a href = "#" class = "sidebar-click"><%= locs['Address'] %></a></p>
<% end %>
</div>
I want to render a partial in another div id = "container"whenever one of the side bar links is clicked and also want to pass locs as a local variable to that partial;
How would I go about doing that?
First of all try using the
link_tohelper method:Then you should create a js bind to handle that ajax response, something like:
UPDATE:
please check the following documentation:
http://apidock.com/rails/ActionView/Helpers/PrototypeHelper/link_to_remote