Thanks Simon, but I'm really new to jQuery - I think I know how to
call a function from the drop handler:

 $("#dropper").droppable({
  accept: "#dragger",
  drop: dropped()

});

function dropped(){
 // do stuff
}

But what do I have to put in the dropped function that actually
accesses rails? You seem to be using $.post, but I don't really know
how this works. Also, I've seen other examples use $.load, and again,
I don't quite get how it works.

Is there any good documentation on this?

cheers again,

DAZ


> Hi,
>
> You need to call a function in your drop handler that goes out to rails to  
> make the changes.
>
> We do the following in some of our jquery handlers:
>
> var c = {};
> c['authenticity_token'] = encodeURIComponent(window._token);
> c['user_id'] = <%= current_user.id %>;
> $.post("<%= url_for(:action => 'lock', :id => @current_page.form_data.id)  
> %>", c);
>
> Cheers
> Simon
>
> On Sun, 07 Dec 2008 04:50:43 +0900, DAZ <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I was wondering if anybody who used jQuery with rails could help me
> > out. I have a droppable that fires a simple function, shown below:
>
> >  $("#list").droppable({
> >   accept: ".item",
> >   hoverClass: 'droppable-hover',
> >   drop: function(ev, ui) {
> >     $(this).append("<br>Dropped!");
> >   }
> > });
>
> > But how could I get this to fire a Rails funciton in the controller so
> > that the dropped item could be changed at a database level? For
> > example, when it is dropped, how would I change the updated_at value
> > to Time.now?
>
> > Thanks,
>
> > DAZ
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to