RJS in a callback


#1

I’m trying to use RJS to construct javascript for an :onDrop callback.

Here’s the code. Fun stuff is the RJS after the :onDrop.

<%= drop_receiving_element :dropAccept, :accept => ‘dragclass’ ,
:onDrop => update_page {|page|page.alert ‘no postback’} %>

This results in the following javascript which throws a syntax error.

//

Anyone have any ideas why?

Many thanks in advance
Andy

Ps. Pretty sure the problem is RJS, since a vanilla JS callback like
below…works fine.
:onDrop => "function(drag, drop){ alert('you droped ’ + drag.id + ’ on ’

  • drop.id) }"