Requesting help on Ajax link_to_remote RJS error

I am trying to make a remote call to an action when I click a link on one page.

I have 'books' and 'haves' models. I have 'my_controller' . In the index.rhtml I have a link 'Add a book'. I am trying to replace the add_form in the same div where the list of books has been shown. When I click the link my form is showing twice along with some try catch blocks saying an RJS error. However I am not having any RJS involved in it.

Could somebody help me to resolve my problem.

Any help is very appreciated, and thanks in advance.

my index.rhtml code is

I am trying to make a remote call to an action when I click a link on one page.

I have 'books' and 'haves' models. I have 'my_controller' . In the index.rhtml I have a link 'Add a book'. I am trying to replace the add_form in the same div where the list of books has been shown. When I click the link my form is showing twice along with some try catch blocks saying an RJS error. However I am not having any RJS involved in it.

Well you do have some rjs right in the render :update block. You should both pass :update to link_to_remote and use render :update. It looks like your new_own action could just be render :partial => 'new_own'

Fred

Thanks! Fred

But I don't have any rjs code in :update block. I am passing :update to link_to_remote and using render :update. I am new to Ajax though I have done rails and ruby programming before. Could you please elaborate more on what should be doing? ?As I understand, I am already doing what you suggested me. Or I am missing or my bad.

Thanks

But I don't have any rjs code in :update block. I am passing :update to link_to_remote and using render :update. I am new to Ajax though I have done rails and ruby programming before. Could you please elaborate more on what should be doing? ?As I understand, I am already doing what you suggested me. Or I am missing or my bad.

Oops, I meant 'You shouldn't both pass :update to link_to_remote and use render :update', quick slip of the keyboard there. And you do have rjs in your :update block (what do you think page.replace_html etc... is ?). Like I said if your action just renderered your partial it would probably be ok (although if you are expected render :partial => 'new_own' to render new_own.rhtml, it won't. It will render _new_own.rhtml)

Fred

Thank you very much. It is working now.