wbsurfver-/E1597aS9LQAvxtiuMwx3w@public.gmane.org
2009-Apr-08 21:51 UTC
authenticity problem with jrails ajax
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 work. function update_server(info) { <%#= remote_function(:url => {:action => ''resize_field''}, :with => ''{col:info.col,width:info.width}'') # auth-OK %> $.ajax({data: {col:info.col,width:info.width,authenticity_token:FORM_AUTH_TOKEN}, dataType:''script'', type:''post'', url:''/shgrid/resize_field''}) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---