title: Extract information from string and save it to database
body: <p>I have multiple columns <code>&lt;ul&gt;</code> which are sortable by jQuery UI. To save positions of <code>&lt;li&gt;</code> inside those <code>&lt;ul&gt;</code> I need to serialize data. </p>
  
  <pre><code>$(function() {
   $("ul.sortable").sortable({
      connectWith: '.sortable',
      update: function(event, ui) {
     /* var position = $('.sortable').sortable('serialize', {
              key: 'menu',
              connected: true
          });*/
      $('div').empty().html( $('.sortable').serial() );
      }
    });
  });
  
  
  (function($) {
  $.fn.serial = function() {
   var array = [];
   var $elem = $(this); 
      $elem.each(function(i) {
        var menu = this.id;
          $('li', this).each(function(e) {
                  array.push( menu + '['+e+']=' + this.id  );
          });
      });
      return array.join('&amp;');      
      }
  
  })(jQuery);
  </code></pre>
  
  <p>This is how I serialize data (found this example on another thread)</p>
  
  <p>I need id of column and id of row so I can save them to database.</p>
  
  <p>Output looks like this: menu1[0]=id_2&amp;menu1[1]=id_1&amp;menu2[0]=id_3&amp;menu2[1]=id_4&amp;menu3[0]=id_5&amp;menu3[1]=id_6</p>
  
  <p>So 'menu1, menu2 ...' are columns ids and id_1, id_2 are row ids. And of course I need to know where to put <code>&lt;li&gt;</code> and I do that by extracting number between [].</p>
  
  <p>So my question is how to extract all relevant information which I mentioned so I can send those information to database.</p>