When the user is clicking on a link with the class "edit_resource", the content of a div should be replaced by a partial. Here is my code:
$(".edit_resource").click(function(){
var id = $(this).attr("id")
$('#id' + id + '_show').html("<%= escape_javascript(render :partial => 'form', :locals => {:@resource => resource})%>")
})
The code is working as expected, except that that escape_javascript doesn't work. The new content of the div is the text
<%= escape_javascript(render :partial => 'form', :locals => {:@resource => resource})%>
, and this is also what is shown on the page.
No code is executed, and my partial isn't rendered. I have tried to use <%== instead of <%= without luck.
I have also tried
<%= raw escape_javascript(render :partial => 'form', :locals => {:@resource => resource})%>
I have even tried to replace the partial part of the code with just simple rails code. That didn't help either.
What can I do?
I use Rails 3.0.10, and my javascript_include_tag is like this:
<%= javascript_include_tag 'jquery-1.6.2.min', 'jquery-ui-1.8.16.custom.min', 'application', 'jquery.rails.js'%>