Topic: Problem with jquery .html or .load
Hi. I'm new on RoR. I've searched the forum for this issue, and although I found similar things, I did not find my answer.
I've been trying to make a div reload after a new post is made. The post is inserted in the database, I'm using format.js so that it goes through my create.js.erb file.
I have my create.js.erb file, and it stops working when I have this line added:
$('#posts-div').html("<%= escape_javascript(render :partial => 'posts', :collection => @posts) %>");
By my testing, it's not accepting the % character, if I \escape it it just writes the text on the Div instead of interpreting as code.
I've tried using .load instead of .html and it works with any file on application, but not with my _posts.html.erb partial.
I know this may be one of already know issues, missing gems, or other, but I've spent so many hours on this that I feel dumb.
Please help me, I'm tired or googling, and I'm almost sure it's something really really simple that I'm missing.
Thank you