RJS in a callback

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) }"

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs