• 0

Bootstrap - Jquery sortable


Question

Hi guys i have a question i have this Jquery function which works fine

$(function () {
    $(".Movable").sortable({
            tolerance: 'pointer',
            revert: 'invalid',
              placeholder: 'span2 well placeholder tile',
            forceHelperSize: true,
            update: function(event, ui) {
                order = $('.Movable').sortable("toArray");
                $.ajax({
                        type: 'GET',
                        url: My_Site+'/themes/mytheme-2/ajax.php?task=Order&user_id='+User_ID+'&orderby='+order,
                        timeout: 2000
                });
            }
        });
});

It saves it into a mysql database under the users_id

 

SO my question is how do i reverse the function to get the order via AJAX and sort the .Movable class

 

Thanks

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

ok i've updated the function to this

$(function () {
	$(".Movable").sortable({
        	tolerance: 'pointer',
        	revert: 'invalid',
      		placeholder: 'span2 well placeholder tile',
        	forceHelperSize: true,
        	update: function(event, ui) {
        		order = $('.Movable').sortable("toArray");
        		$.ajax({
            			type: 'POST',
            			dataType: 'json',
            			url: My_Site+'/themes/mytheme-2/ajax.php?task=Order&user_id='+User_ID,
            			timeout: 2000,
            			data: {orderby:order}
        		});
    		}
    	});
});


and this is the value that is saved

["friends","notifications","messages","search","member_online","new_member"]

SO how do sort the div's by "id" as saved

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.