June 20th, 2013, 10:10 AM
Update div with content from Ajax.
Hi, i'm using Jquery draggable, when you drag an item in a div it get's added to the Database.. But now my question is, once it's added to the database.. The list has to refresh and show that it's added...
Now.. what's the best practice to do this? Now the list get's called like this using php
Should i update the list using a jquery function that calls the ajax to the list? And use that in the first place instead of loading it with PHP? Thanks, i'm really stuck in this logic
<?php foreach($lijsten as $lijst) : ?>
<div class="dropper" id="<?= $lijst['id'] ?>">
<?php endforeach ?>
June 20th, 2013, 12:04 PM
If your re-ordering the <li> elements with the jQuery .css() API and your sending the updated data with the jQuery .ajax() API, to the update the list position, with your PHP/MySQL/Database; then you should have the effect you need. Because the <li> element's position would remain the same, on the current page and once the page reloads; the updated <li> positions will be applied (from your database) to the current page. You see what I am saying?
Here is a pretty good tutorial about what you are trying to do; just encase you would like to see how someone has already accomplished this method: http://tutorialzine.com/2010/03/ajax...php-mysql-css/.