#1
  1. No Profile Picture
    frequent PHP idiot
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    354
    Rep Power
    12

    Serialize sortable ul is empty


    The alert is always empty. What am I doing wrong?


    PHP Code:
              <script>
              $(function() {
                $( 
    "#sortable" ).sortable({
                                     
    update: function( eventui ) {

                                     var 
    updated = $("#sortable").sortable('serialize');
                                      
    alert($("#sortable").sortable('serialize'));
                                     }
                });
                $( 
    "#sortable" ).disableSelection();
              });
              
    </script>
            </head>
            <body>

            <ul id="sortable">
              <li id="1" class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
              <li id="2" class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
              <li id="3" class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 3</li>

            </ul> 
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    101
    Rep Power
    27
    Note: If serialize returns an empty string, make sure the id attributes include an underscore. They must be in the form: "set_number" For example, a 3 element list with id attributes "foo_1", "foo_5", "foo_2" will serialize to "foo[]=1&foo[]=5&foo[]=2". You can use an underscore, equal sign or hyphen to separate the set and number. For example "foo=1", "foo-1", and "foo_1" all serialize to "foo[]=1".
    from http://api.jqueryui.com/sortable/#method-serialize

IMN logo majestic logo threadwatch logo seochat tools logo