Solved

jquery draggable database update

Posted on 2013-02-04
11
272 Views
Last Modified: 2013-02-25
In my previous post http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28019313.html#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  )
0
Comment
Question by:erikTsomik
  • 6
  • 5
11 Comments
 
LVL 19

Author Comment

by:erikTsomik
ID: 38853147
any suggestions
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38853155
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 }
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 38853667
yes that is exactly right. I will send 2 ids
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38853682
 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

0
 
LVL 19

Author Comment

by:erikTsomik
ID: 38860941
it is always update the last dropped element what if i need to update the one that was dropped before
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 82

Expert Comment

by:leakim971
ID: 38860955
in your coldfusion code get previousid parameter value not id
of perhaps you don't need the new one so just pass previousid
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 38860983
I may not have a coldfsuion code for that page. The new post is here

http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28022506.html.


Really having a hard time figuring out this issue
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38861019
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.
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 38861036
right . Like I said I made some changes to the code which I shown here
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28022506.html.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38861070
So you as for a solution, I give you a code, you don't use it or give any feedback
what can I do?
 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

}
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 38861120
NO  I do not use that piece because I reconstruct the code a little. Please take a look at this post
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28022506.html.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now