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...
requests_controller.rb
def download
IO.foreach "#{RAILS_ROOT}/Backend/History/#{params[:filename]}" do |line|
@file_content << line
@file_content << '<br/>'
end
end
Code in Jquery is...
jQuery("#play").click(function() {
jQuery.get("/requests/download_log", { filename: filename});
});
filenameparameter../../config/database.ymlwould download your database configuration file, including any passwords you might have stored in there.