How to eliminate replace_html alert pop-up in RJS

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

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

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

Thanks,

Tam

there is a similar thread:
RJS - checking if element exists? - Rails - Ruby-Forum