Hi all again, I still working with Beginning Rails 3 book, and I''ve the following problem: Pg. 205 Responding to Requests with :format => :js When I try to *app/views/articles/show.html.erb* <%= render @article %> <hr/> <h3>Comments:</h3> <div id="comments"> <%= render @article.comments %> </div> *<%= link_to "new comment", new_article_comment_path(@article, :format => :js),* * :remote => true, :id => ''new_comment_link'' %>* *app/views/comments/new.js.erb:* $("<%= escape_javascript render(:file => ''comments/new.html.erb'') %>").insertAfter(''#comments''); $(''#new_comment_link'').hide(); When I click on the "New comment" link, this page is render: http://localhost:3000/articles/1/comments/new.js $("<form accept-charset=\"UTF-8\" action=\"/articles/1/comments\" class=\"new_comment\" id=\"new_comment\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"Iom91p0FDuTiQRuj1EFz4iexBuditCIzJBq2cazFniQ=\" /><\/div>\n\n<div>\n <h3>Create new comment<\/h3>\n <p>\n <label for=\"comment_name\">Name<\/label><input id=\"comment_name\" name=\"comment[name]\" size=\"30\" type=\"text\" /><br/>\n <label for=\"comment_email\">Email<\/label><input id=\"comment_email\" name=\"comment[email]\" size=\"30\" type=\"text\" /><br/>\n <label for=\"comment_body\">Body<\/label><textarea cols=\"40\" id=\"comment_body\" name=\"comment[body]\" rows=\"20\"><\/textarea>\n <\/p>\n <p>\n <input id=\"comment_submit\" name=\"commit\" type=\"submit\" value=\"Add\" />\n <\/p>\n<\/div>\n<\/form>").insertAfter(''#comments''); $(''#new_comment_link'').hide(); I downloaded rails.js and jquery-1.4.4.min.js file, I think it''s a problem with my JavaScript files or something. Please I''ll really appreciate your help. Regards, <http://localhost:3000/articles/1/comments/new.js> -- TSU. Amador Cuenca -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Amador, The jquery-1.4.4.min.js file you have is broken. Try this one instead: http://code.jquery.com/jquery-1.4.4.min.js Cheers, -- Rida Al Barazi Twitter: @rida Blog: http://rida.me Book: http://beginningrails.com On Dec 16, 5:02 pm, Amador Antonio Cuenca <sphi0...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all again, > > I still working with Beginning Rails 3 book, and I''ve the following problem: > > Pg. 205 Responding to Requests with :format => :js > > When I try to > > *app/views/articles/show.html.erb* > > <%= render @article %> > <hr/> > <h3>Comments:</h3> > <div id="comments"> > <%= render @article.comments %> > </div> > > *<%= link_to "new comment", new_article_comment_path(@article, :format => > :js),* > * :remote => true, :id => ''new_comment_link'' %>* > > *app/views/comments/new.js.erb:* > > $("<%= escape_javascript render(:file => ''comments/new.html.erb'') > %>").insertAfter(''#comments''); > $(''#new_comment_link'').hide(); > > When I click on the "New comment" link, this page is render: > > http://localhost:3000/articles/1/comments/new.js > > $("<form accept-charset=\"UTF-8\" action=\"/articles/1/comments\" > class=\"new_comment\" id=\"new_comment\" method=\"post\"><div > style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" > type=\"hidden\" value=\"✓\" /><input > name=\"authenticity_token\" type=\"hidden\" > value=\"Iom91p0FDuTiQRuj1EFz4iexBuditCIzJBq2cazFniQ=\" > /><\/div>\n\n<div>\n <h3>Create new comment<\/h3>\n <p>\n <label > for=\"comment_name\">Name<\/label><input id=\"comment_name\" > name=\"comment[name]\" size=\"30\" type=\"text\" /><br/>\n <label > for=\"comment_email\">Email<\/label><input id=\"comment_email\" > name=\"comment[email]\" size=\"30\" type=\"text\" /><br/>\n <label > for=\"comment_body\">Body<\/label><textarea cols=\"40\" > id=\"comment_body\" name=\"comment[body]\" rows=\"20\"><\/textarea>\n > <\/p>\n <p>\n <input id=\"comment_submit\" name=\"commit\" > type=\"submit\" value=\"Add\" />\n > <\/p>\n<\/div>\n<\/form>").insertAfter(''#comments''); > > $(''#new_comment_link'').hide(); > > I downloaded rails.js and jquery-1.4.4.min.js file, I think it''s a problem > with my JavaScript files or something. > > Please I''ll really appreciate your help. > > Regards, > <http://localhost:3000/articles/1/comments/new.js> > -- > TSU. Amador Cuenca > > blog.rar > 126KViewDownload-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks, I didn''t notice that. Regards, -- TSU. Amador Cuenca -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.