Say I’m inside a JavaScript function, I’d like access to data within the Rails line like this:
var DATA_USED
html = "<%= escape_javascript(render :partial => 'change_date_range', :locals => {:end_date_string => DATA_USED }) %>";
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You really should use AJAX (I recommend jQuery) for this. You’ll want to have JS send a request back to your Rails server with the JavaScript variable as a param in the request.