Ben Sinclair Ben Sinclair - 1 year ago 66
jQuery Question

JQuery - Ajax saving sortables in connected lists when sortable item is moved

I have multiple JQuery sortable lists that connect with each other... They allow you to assign users to certain roles.

Basically what I want to do is when a user is dragged from one list to another, I want JQuery to pick up the first list that the user was moved from so that I can send an AJAX request to delete it from that list in my database.

I tried the following but every time you move the user over a list and haven't even dropped it within a list, it sends this request which means I'll be sending multiple AJAX requests... Does that make sense?

$( ".selector" ).sortable({
out: function(event, ui) { ... }

From my testing, I can use the following code to just update the list that user has been moved to so I've got the second half covered:

$( ".selector" ).sortable({
receive: function(event, ui) { ... }

Hopefully I am making sense :)

Answer Source

you might try out the update and receive-event.
otherwise JRTFM

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download