Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jquery draggable database update

Posted on 2013-02-04
11
Medium Priority
?
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Suggested Courses

598 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