Welcome Guest, Not a member yet? Register   Sign In
some jquery help needed (problem with sortable)
#1

[eluser]Bramme[/eluser]
Hey all

I need some help with jQuery. Normally, I'd try and find out myself, but I've been trying all afternoon and can't figure it out.

I have a simple list that needs sorting. I'm using the jQuery UI sortable plugin.

This is what I have allready:
Code:
$(function() {
    $("#site_navigation a").click(function() {
        return false;
    });
    
    $("#site_navigation").sortable({
        items: "li",
        cursor: "move",
        update: function(event, el) {
            var foobar = $("#site_navigation").sortable("serialize");
            alert(foobar);
        }
    });
});
The update function is where I'm stuck: according to the docs, the serialize option should give me an array I can use to determine in which order the items are sorted. However, that alert turns up empty.

How do I proceed from here? Don't worry about the ajax, I'm pretty sure I can figure that out myself.
#2

[eluser]xwero[/eluser]
from the jquery ui docs :
Quote:It works by default by looking at the id of each item in the format 'setname_number', and it spits out a hash like "setname[]=number&setname;[]=number".
#3

[eluser]Bramme[/eluser]
god damn. i only had an id in format 'number'... added 'setname' and it works. thanks!




Theme © iAndrew 2016 - Forum software by © MyBB