jQuery draggable and invoke function -


i have table of games laid out in grid , want drag square anther square, , invoke function. game squares must have id corresponding game represent (or contain div id).

i want drag table cell other table cell , invoke ajax action both id numbers, can swap game bookings.

i don't know start , can't find close.

yes, have how to, doesn't show me how extract id number each element.

you should able need when drop performed. if basic set is:

    <table><tr><td id="cell_1"></td><td id="cell_2"></td></tr></table> 

just set cells draggable , droppable in drop event:

    $('td').draggable().droppable({             drop: function(event, ui) {                     var dragged_id = ui.draggable.attr('id'); // cell dragged                     var dropped_id = $(this).attr('id'); // cell dropped                     $.ajax(...);             }     }); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -