escape_javascript(render(:partial => ‘pages/top_link’)) %>");
How it should display my render partial page.
What is the file-extension of the script you posted? Does it include
.erb as the last segment? If not, then the erb code won’t be evaluated
at all.
And so, if you want it to also include interpolation, using erb syntax,
you have to tack .erb to the end of the filename, and you have to put
the file in a location where it will be interpreted (hint: not in
/public/javascripts).
But step back and think if there’s another way to write your JavaScript
so you don’t need that interpolation. Can you write that variable data
into the partial for /org_pages? The reason you would want to do that is
so that the JavaScript can be compressed and minified along with all the
other static assets. The moment you start generating your JavaScript
dynamically, you force the browser to re-load it from scratch each page
load, along with all the HTML. Your Ajax call is already creating a
dynamic snippet of HTML – what’s a little more HTML there?
Walter
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.