Drag Drop Div deletion

Go To StackoverFlow.com

2

I currently am using a customised drag and drop using the Jquery UI method. I use both onmousedown and onmouseup events on my drag and I was wanting to make deletion of objects as easy as possible.

This would not "hide" the object - Jquery UI does not support this method I believe. But it would tell the database not to show it when it next collects the objects from the database.

I was hoping to make a trash bin type idea, where members would simply have to drag their object over a trash bin icon and that would force a JS function of some type..

Is this possible?

2012-04-04 20:38
by Andrew


2

You'll need to make an Ajax call to the server side, to a PHP page that would remove the specific item from the database.

So once the item is dropped on the bin, you'll need to make the Ajax call, get the response (success/failure), and act accordingly back on the page (remove the item/display an error message).


Edit based on comments:
If you wanted to be able to tell if an item was dropped on a target element, you can use jQueryUI Droppable

2012-04-04 20:41
by Madara Uchiha
Yeah I was going to include that in my javascript function I'm just not sure how I would get the client-side (JS) to know if an item is being place onto the "bin" (deletion div - Andrew 2012-04-04 20:47
http://jqueryui.com/demos/droppable - Madara Uchiha 2012-04-04 20:49
OMG your so helpful thank you so much : - Andrew 2012-04-04 20:58
@Andrew: No problem. Make sure to accept this answer as correct by clicking the green V under the vote count - Madara Uchiha 2012-04-04 21:01
Ads