How to eliminate replace_html alert pop-up in RJS


#1

Hello,

I’m using RJS for AJAX call. Something like:

page[“edit_single_client_div” + params[“client_id”]].replace_html
:partial => ‘client_single_display’, :locals => {:the_client =>
SmsClient.valid.find_by_id(params[:client_id]), :recipients_session_id
=> params[:recipient_session_id]}

it works fine but sometimes the DIV doesn’t exist on the page because
the user has paginated that piece of the page. the replace_html displays
Alert about that. I want to keep silent and just ignore the fact that
the DIV doesn’t exist on page anymore.

Any ideas how to do that?

Thanks,

Tam


#2

how about making it conditional? check existence of that div
beforehand.


#3

Thanks MaD. Could you please provide a code on how to do this in RJS?

Thanks,

Tam


#4

there is a similar thread:
http://www.ruby-forum.com/topic/87505