Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble inserting a rails partial using JQuery
    primarykey
    data
    text
    <p>The following line of code:</p> <pre><code>$("#comments_&lt;%=@comment.post.id %&gt;").append("&lt;%= escape_javascript(render :partial =&gt; 'posts/comment', :locals =&gt; { :comment =&gt; @comment }) %&gt;"); </code></pre> <p>Is supposed to instert a partial as html inside the coments_xx div tag. what is happening is that the content of the partial is inserted but not interpreted as html, i mean, instead of inserting a comment with its right format i see the whole code in the web page:</p> <p>Example (this is how it insert it in the webpage):</p> <pre><code>1 Comment &lt;div id=comment_5_34&gt; &lt;span class=dateandoptions&gt; Posted less than a minute ago&lt;br/&gt; &lt;a href=/comments/34/5 data-method=post data-remote=true rel=nofollow&gt;Deletea&gt; span&gt; &lt;p&gt;&lt;b&gt;otra pruebab&gt; wrote:p&gt; &lt;br/&gt; &lt;p&gt;&lt;b&gt; Webpage:b&gt;asss.comp&gt; &lt;br/&gt; &lt;p class=comment-body&gt;heeyeyeyyhep&gt;div&gt; Thanks for commenting! </code></pre> <p>If i analize the javascript code inserted i get something like this (i used firebug extension to see it):</p> <pre><code>/* Add the new comment to the bottom of the comments list */ $("#comments_5").append("&amp;lt;div id=comment_5_34&amp;gt; &amp;lt;span class=dateandoptions&amp;gt; Posted less than a minute ago&amp;lt;br/&amp;gt; &amp;lt;a href=/comments/34/5 data-method=post data-remote=true rel=nofollow&amp;gt;Deletea&amp;gt; span&amp;gt; &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;otra pruebab&amp;gt; wrote:p&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;p&amp;gt;&amp;lt;b&amp;gt; Webpage:b&amp;gt;asss.comp&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;p class=comment-body&amp;gt;heeyeyeyyhep&amp;gt;div&amp;gt;"); </code></pre> <p>Finally this is the code of the partial that i am inserting:</p> <pre><code>&lt;div id="comment_&lt;%=comment.post.id%&gt;_&lt;%=comment.id%&gt;"&gt; &lt;span class="dateandoptions"&gt; Posted &lt;%= time_ago_in_words(comment.created_at) %&gt; ago&lt;br/&gt; &lt;%= link_to 'Delete', {:controller =&gt; 'comments', :action =&gt; 'eliminar', :id =&gt; comment.id, :post_id =&gt; comment.post.id}, :method =&gt; :post, :remote =&gt; true %&gt; &lt;/span&gt; &lt;p&gt;&lt;b&gt;&lt;%= comment.user_name %&gt;&lt;/b&gt; wrote:&lt;/p&gt; &lt;br/&gt; &lt;% if comment.web_page != nil %&gt; &lt;p&gt;&lt;b&gt; Webpage:&lt;/b&gt;&lt;%= comment.web_page %&gt;&lt;/p&gt; &lt;% end %&gt; &lt;br/&gt; &lt;%= content_tag(:p, comment.contenido, :class =&gt; "comment-body") %&gt; &lt;/div&gt; </code></pre> <p>Hope i could explain myself well!</p> <p>thanks in advance for your help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload