0

First all i'm not familiar of jquery, if it's a noob question forgive me. I have a web app and trying to use jQuery sortable function to drag drop data table to change order_id on mysql via php.

If i use jquery 1.11.1 and jquery ui 1.10.3 my function doesn't send data to my php file.

But if i use jquery 1.3.2 and jquery ui 1.7.2 my function send data and it gives following success message on console:

XHR finished loading: GET"http://localhost/.../ArticlesSort.php?listItem[]=2&listItem[]…tItem[]=4&listItem[]=5&listItem[]=6&listItem[]=7&listItem[]=8&listItem[]=9"

My jquery function looks like

jQuery(document).ready(function() { 
    $("#test-list").sortable({ 
        handle : '.handle', 
        update : function () { 
            var order = $('#test-list').sortable('serialize'); 
            $("#info").load("ArticlesSort.php?"+order); 
        } 
    }); 
});

What am i missing? Any help will greatly appricated.

1 Answer 1

1

I found an answer on jQuery UI Sortable, then write order into a database question's related answer. And it worked. I'm pasting my final code here if someone will have same issue to find solution easily:

$("#test-list").sortable({ 
        handle : '.handle', 
        update : function () { 
            var order = $('#test-list').sortable('serialize'); 
            $.ajax({
                data: order,
                type: 'GET',
                url: 'ArticlesSort.php?'+order,
            });
        } 
});
Sign up to request clarification or add additional context in comments.

2 Comments

i reckon the data attribute is not needed there as you are appending the same value in URL....
And also you can mark your own answer as THE ANSWER

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.