Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- $("#sortable").sortable({
- axis: 'y',
- update: function(event, ui) {
- var data = $(this).sortable('serialize');
- $.ajax({
- data: data,
- type: 'POST',
- url: 'updatesort.php'
- });
- }
- });
- });
- <ul id="sortable" class="ui-sortable">
- <li id="item-1"><button class="removeli">remove</button></li>
- <li id="item-2"><button class="removeli">remove</button></li>
- <li id="item-3"><button class="removeli">remove</button></li>
- <li id="item-4"><button class="removeli">remove</button></li>
- <li id="item-5"><button class="removeli">remove</button></li>
- </ul>
- $("#sortable button.removeli").on("click", function () {
- $(this).parent().remove();
- });
- $(".removeli").click(function() {
- //
- // get <li>-id for removing it from the database
- //
- $(this).closest("li").remove();
- var data = $("#sortable").sortable('serialize');
- $.ajax({
- data: data,
- type: 'POST',
- url: 'updatesort.php'
- });
- });
Add Comment
Please, Sign In to add comment