Forum: Ruby on Rails authenticity problem with jrails ajax

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
on 2009-04-09 01:52
(Received via mailing list)
I'm using jrails and I found when I use the authenticity_token in
certain javascript calls, that the
url works differently in that the paramters in the :with clause get
dropped if they are in a json type syntax.
Below is an example of a remote_function() call from JS that used to
work fine without authenticity.
When I enabled authenticity it adds the authenticity token
automatically, but drops sending the
data in the :with part. I commented out this code as shown and
inserted an actual ajax call that does work fine, with authenticity,
but seems like not as much of the prefered approach. I've had similar
problems with field_observer() calls in some cases. I think if the
json syntax is not used when there is just one parameter, it does

function update_server(info)

<%#= remote_function(:url => {:action => 'resize_field'},
                              :with =>
'{col:info.col,width:info.width}') # auth-OK
dataType:'script', type:'post', url:'/shgrid/resize_field'})
This topic is locked and can not be replied to.