Link to home
Start Free TrialLog in
Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on

jquery draggable database update

In my previous post https://www.experts-exchange.com/questions/28019313/drag-and-drop.html?anchorAnswerId=38852724#a38852724

I show the code to what I am trying to do . now i need to be able to update the database when dropping the draggable into the small (area. The area when I just dropped the item basically overwrite the previously dragged item  )
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

ASKER

any suggestions
Avatar of leakim971
update the database using ajax, why not, but what is and where do you gett the data you want to send?

<li id="997" class="draggable ui-draggable" style="position: relative;">test1</li>

You want to send the id? For example you previously put li with id 998 in the droppable and now you put 997
So you send something like { id:997, previousid:998 }
yes that is exactly right. I will send 2 ids
 drop: function(e, ui) {

     var previousid = $(".previouslyDroppedClass").attr("id");
     var id =  ui.draggable.attr("id");
     $(".previouslyDroppedClass").removeClass("previouslyDroppedClass");
     ui.draggable.addClass("previouslyDroppedClass");
     // AJAX CALL USING POST METHOD
     $.post("yourURLhere", { "id":id, "previousid":previousid }, function(messageFromCF) {});

// your previous code here

}

Open in new window

it is always update the last dropped element what if i need to update the one that was dropped before
in your coldfusion code get previousid parameter value not id
of perhaps you don't need the new one so just pass previousid
I may not have a coldfsuion code for that page. The new post is here

https://www.experts-exchange.com/questions/28022506/jquery-droppable-help.html.


Really having a hard time figuring out this issue
I may not have a coldfsuion code for that page. The new post is here

I dunno but if you're using ajax you have server side process, no?

so it's the same logic for any language, just send the right id to the right server side page/functio to remove the right data/row from your database.
right . Like I said I made some changes to the code which I shown here
https://www.experts-exchange.com/questions/28022506/jquery-droppable-help.html.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
NO  I do not use that piece because I reconstruct the code a little. Please take a look at this post
https://www.experts-exchange.com/questions/28022506/jquery-droppable-help.html.