title: Access controller action variable in jquery and display it in ruby on rails
body: <p>I m new in Jquery and Ajax.... What i want to do is.. I have a controller action which reads a file content and stores it in a variable. I want to pass file name from jquery and want to access that file content through variable in jquery and display it in a div tag. For this i have used this code in controller...</p>
  
  <p>requests_controller.rb</p>
  
  <pre><code>def download
     IO.foreach "#{RAILS_ROOT}/Backend/History/#{params[:filename]}" do |line|
        @file_content &lt;&lt; line
        @file_content &lt;&lt; '&lt;br/&gt;'
     end 
  end
  </code></pre>
  
  <p>Code in Jquery is...</p>
  
  <pre><code>jQuery("#play").click(function() {
      jQuery.get("/requests/download_log", { filename: filename});
  });
  </code></pre>