开发者

Rails 3 render form has text not has html

I would like to rendex a form (in a specific div) without refreshing the window. The problem is that

$('#details').html("<%= escape_javascript(render('form')) %>");

is rendering my form hast text instead of html.

The code:开发者_StackOverflow in my index.html.erb I have

<%= link_to 'Edit note', edit_note_path(:id => Note.user_note(wine.id,current_user.id)),:remote => true %><br/>

then In my Controller I have

 def edit
    @note = Note.find(params[:id])
    respond_to do |format|
      format.js {}
    end
  end

Then in edit.js.erb I have:

$('#details').html("<%= escape_javascript(render('form')) %>");

What happens is that the div details get's the form has text not as an html form appearance.

I'm using Rails 3.08, Jquery ..and so far no problems with the ajax ..is just in this particular case that I want to render html instead of text.

am I missing something ? Thanks for your time :)


Try:

$('#details').html("<%== escape_javascript(render('form')) %>");

(Note the use of <%== in place of <%=).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜