开发者

How do you access a JavaScript variable inside a Rails escape_javascript line?

Say I'm inside a JavaScript function, I'd like access to data within the Rails line like this:

var DATA_USED
html = "<%= e开发者_JS百科scape_javascript(render :partial => 'change_date_range', :locals => {:end_date_string => DATA_USED }) %>";


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜