I have a link that needs to show a hidden Div on click.
For it, I am using :
<%=link_to video.title,display_path(:format=>:js,:id=>video.id),:remote=>true%>
in the controller i have:
def display
@video=Video.find(params[:id])
respond_to do |format|
format.js
end
end
and in the js.erb, i have,
$('#vid_<%=@video.id%>').fadeIn('slow');
But when i run the app, upon clicking the link, the js.erb is rendered as text.It just displays:
$('#vid_<%=@video.id%>').fadeIn('slow');
Ok I found the solution.I made a silly mistake.I forgot to skip prototype while creating the App.This caused trouble when i tried to use Jquery.Its all good now.