# RJS in a callback

**URL:** <https://www.ruby-forum.com/t/rjs-in-a-callback/108734>\
**Category:** Rails\
**Created:** [July 6, 2007, 1:04pm UTC](https://www.ruby-forum.com/t/rjs-in-a-callback/108734 "2007-07-06T13:04:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [July 6, 2007, 1:04pm UTC](https://www.ruby-forum.com/t/rjs-in-a-callback/108734/1 "2007-07-06T13:04:55Z")

</div>

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