开发者

rails escaping html with jquery :remote => true

开发者 https://www.devze.com 2023-03-13 21:34 出处:网络
I have this piece of code in my .js.erb file: $(\"#register_holder\").html(\"<%= escape_javascript(render(\"layouts/register\")) %>\");

I have this piece of code in my .js.erb file:

$("#register_holder").html("<%= escape_javascript(render("layouts/register")) %>");

I will expect this to put the html in the register_holder div but instead it goes and puts this:

<div id="register_holder">    &lt;form accept-charset=UTF-8 action=/utilizator class=new_utilizator data-remo开发者_JS百科te=true id=new_utilizator method=post&gt;&lt;div style=margin:0;padding:0;display:inline&gt;&lt;input name=utf8 type=hidden value=&amp;#x2713; /&gt;&lt;input name=authenticity_token type=hidden value=5tHgeGujhAMWGCQ9ioRK6Ra/hJgyFsBAm8uedCVZKP0= /&gt;div&gt;            &lt;ul&gt;                  &lt;li&gt;Email nu poate fi golli&gt;            ul&gt;        &lt;span&gt;          &lt;div class=field_with_errors&gt;&lt;input id=utilizator_email name=utilizator[email] placeholder=Scrieţi emailul dacă eşti interesant/ă size=30 type=email value= /&gt;div&gt;          &lt;input class=button id=utilizator_submit name=commit type=submit value=Anunţă-mă /&gt;        span&gt;form&gt;</div>

What am I doing wrong here ?

Thanks,


I had this problem with rails 3.1.0.rc2. I believe it was impacting rails 3.0.x rcs also. Try upgrading your version of rails. Here's some more information on the problem: https://github.com/rails/rails/issues/1553

0

精彩评论

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

关注公众号