Updating a new id created from Ajax call in the same .js.rjs


I’m playing a little with ajax and some visual effects.

What I’m doing is creating and modifying rows, open a new window with
ajax, do the stuff, and update the main div page with the new row. The
action can be add a new row, modify a present row, or delete a row.

If the row has been modified, I can issue a page <<
visual_effect(:highlight, @invoices_line.id.to_s, :duration => 3) and
see the new row updated.

The problem, is that when I add a new row, the new id doesn’t exist in
the main page, but it really exists in the new updated div, but it seems
that the javascript can’t find it.

Without reloading, modifying the just created row, the visual effect

Maybe isn’t working because I’m calling the visaul effect after the
update and the browser/javascript doesn’t know (yet) the newly ID ?

For testing purposes I added an alert with the new id to see if it
really exists, and before the alert I update the div, and I can see that
the new row with the new id really exists (has been updated…)

The error that I’m getting is RJS Error [obejct Object]

any ideas ?

thanks …