AJAX

def new   @answer = Answer.new   respond_to do |format|     format.js do       render :update do |page|         page.hide "add_answer_link_for_post_#{@post.id}"         page.replace_html "new_answer_form_for_post_#{@post.id}",                           :partial => "new"       end     end   end end

_new.html.erb: <% remote_form_for(:answer, :url => answers_path) do |form| %> <fieldset>   <legend>New Answer</legend>   <%= form.text_area :body, :rows => 10, :cols => 40 %>   <%= submit_tag "Create" %> </fieldset> <% end %>

def create   @answer = Answer.new(params[:answer])   @answer.user = User.find(session[:user_id])   @answer.post = @post   respond_to do |format|     if @answer.duplicate? or @post.answers << @answer       format.js do         render :update do |page|            page.replace_html "answers_for_post_#{@post.id}",                              :partial => "answers/answer",                              :collection => @post.answers            page.show "add_answer_link_for_post_#{@post.id}"            page.hide "new_answer_form_for_post_#{@post.id}"         end       end     else       format.js { render :nothing => true }     end   end end

_answer.html.erb <div id="answer_<%= answer.id %>" class="answer">   <hr noshade />   <% if logged_in? and answer.authorized? (User.find(session[:user_id])) %>   <span class="edit_link" style="float: right">   <%= link_to_remote "(delete)",           :url => answer_path(answer.post.blog, answer.post, answer),           :method => :delete,           :confirm => 'Are you sure?' %>   </span>   <% end %>

ABove is the code that uses AJAX calls..but gives errors wen run..can any 1 help me in implementing AJAX in rails..i need it urgent

Can you post the error message?