Sir can u guide me in implementation of Ajax calls in Ruby and Rails?
wen i m implementing a new page it gives th following op:




"try {
Element.hide("add_answer_link_for_post_-613772418");
Element.update("new_answer_form_for_post_-613772418", "<form
action=\"/answers\" method=\"post\" onsubmit=\"new
Ajax.Request('/answers', {asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return false;\">\n<fieldset>\n
<legend>New Answer</legend>\n  <textarea cols=\"40\"
id=\"answer_ans_string\" name=\"answer[ans_string]\"
rows=\"10\"></textarea>\n  <input name=\"commit\" type=\"submit\"
value=\"Create\" />\n</fieldset>\n</form>\n\n");
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('Element.hide(\"add_answer_link_for_post_-613772418\");\nElement.update(\"new_answer_form_for_post_-613772418\",
\"<form action=\\\"/answers\\\" method=\\\"post\\\" onsubmit=\\\"new
Ajax.Request(\'/answers\', {asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return false;\\\">\\n<fieldset>\\n
<legend>New Answer</legend>\\n  <textarea cols=\\\"40\\\"
id=\\\"answer_ans_string\\\" name=\\\"answer[ans_string]\\\"
rows=\\\"10\\\"></textarea>\\n  <input name=\\\"commit\\\"
type=\\\"submit\\\" value=\\\"Create\\\"
/>\\n</fieldset>\\n</form>\\n\\n\");'); throw e }"


I want to eliminate this problem wen i m implementing ajax requests..
Please help..


ALso m unable to understand the follwing code:


  <div id="comments_for_post_<%= post.id %>">
    <%= render :partial => "comments/comment", :collection =>
post.comments %>
  </div>
  <% if logged_in? %>
  <div id="add_comment_link_for_post_<%= post.id %>">
    <%= link_to_remote "Add a comment",
                       :url => new_comment_path(post.blog, post),
                       :method => :get %>
  </div>
  <div id="new_comment_form_for_post_<%= post.id %>">
  </div>
  <% end %>
</div>



def new
  @comment = Comment.new
  respond_to do |format|
    format.js do
      render :update do |page|
        page.hide "add_comment_link_for_post...@post.id}"
        page.replace_html "new_comment_form_for_post...@post.id}",
                          :partial => "new"
      end
    end
  end
end

please can anyone guide me wat does
"add_comment_ink_for_post...@post.id}" do?????
-- 
Posted via http://www.ruby-forum.com/.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to