title: jquery sortable > nested uls
body: <p>I'm trying to nest several lists inside the main list. Goal is to organize the menu and submenus.</p>
  
  <p>The html:</p>
  
  <pre><code>&lt;ul id="pages_0" class="sortable-list"&gt;
    &lt;li id="page_14"&gt;home
      &lt;ul id="pages_14" class="sortable-list"&gt;
        &lt;li id="page_21"&gt;nieuwsarchief&lt;/li&gt;
        &lt;li id="page_19"&gt;waarom bouwelement&lt;/li&gt;
        &lt;li id="page_20"&gt;vacatures&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li id="page_23"&gt;ondersteuning
      &lt;ul id="pages_23" class="sortable-list"&gt;
        &lt;li id="page_24"&gt;brochures&lt;/li&gt;
        &lt;li id="page_25"&gt;constructie&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li id="page_18"&gt;producten&lt;/li&gt;
    &lt;li id="page_26"&gt;contact&lt;/li&gt;
    &lt;li id="page_28"&gt;referenties&lt;/li&gt;
    &lt;li id="page_11"&gt;projectaanpak
      &lt;ul id="pages_11" class="sortable-list"&gt;
        &lt;li id="page_15"&gt;advies&lt;/li&gt;
        &lt;li id="page_13"&gt;productie&lt;/li&gt;
        &lt;li id="page_12"&gt;tekenwerk&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Current code:</p>
  
  <pre>
      $(".sortable-list").sortable({
          update: function() {
              $.post('/pages/order/0/, $('#pages_0').sortable("serialize", {key: 'pages_0[]'}))
          }
      });
      $(".sortable-list").disableSelection(); 
  </pre>
  
  <p>However, when i set this, the var that is being sent is 'pages_0' of course.</p>
  
  <p>So, what I'm trying:</p>
  
  <pre>
      $('ul.sortable-list').each(function() {
          pid = '';
          pid = $(this).attr('id').split('_');
          pid = pid[1];
          alert(pid);
          $('#pages_'+pid).sortable({
              update: function() {
                  $.post('/pages/order/'+pid, $('#pages_'+pid).sortable("serialize", {key: 'pages_'+pid+'[]'}))
              }
          });
          $('#pages_'+pid).disableSelection();
          alert(pid);
      });
  </pre>
  
  <p>However, my problem: in my case: if i use the second jquery, whenever i sort i get '11' (from pages_11, the last ul). I want the id of the parent ul of course. Any ideas on solving this? Thx!</p>