$(“#wall_add”)。html(“<%= escape_javascript(render(:partial =>”walls / form“))%>”);
显示我
<form accept-charset="UTF-8" action="/walls" class="new_wall" id="new_wall" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="9QBC/0uUIH2xJdZBcvTZb9Nsm1kL2hFipQq6NUdmCzU=" /></div> <div class="field"> <label for="wall_content">Content</label><br /> <textarea cols="40" id="wall_content" name="wall[content]" rows="20"></textarea> </div> <div class="actions"> <input name="commit" type="submit" value="Create Wall" /> </div> <input id="recipient" name="recipient" type="hidden" value="2" /> </form>
作为文字但不作为html元素,http://deeflow.com/changer/remote.png
答案 0 :(得分:0)
您需要致电html_safe
$("#wall_add").html("<%= escape_javascript( render(:partial => "walls/form").html_safe ) %>");