In my rails app I would like to perform a certain block of JS when in my 'events' controller, and another block while in my 'movie_interests' controller.
I am aware that this condition can be checked using 'params[:controller] == ...', but this is ruby code. How can I accomplish this from a javascript file?
$(".search-results").on('click', ".movie-click", function(){
if (params[:controller] == "events") { //This is incorrect syntax, but shows more or less what I want to accomplish
$('#event_rt_id').val($(this).data("id"));
$('#movie-poster').html('<img id="selected-poster" src="' + $(this).data("poster") + '" />' );
}
});