title: jquery on drag update, change db
body: <p>I have a set of Data (posted below) that gets sorted by 'section'. When it is loaded on the page each item gets sorted into a UL according to its section.</p>
  
  <p>What I am trying to accomplish is when the user drags an item to another section and drops it, the section in the DB will automatically update (ie. drag item2 to section 2, section will update from 0 to 2).</p>
  
  <p>I dont care about keeping the items in a specific order, the only thing that needs to update is the section #</p>
  
  <p>Functionality Demonstrated with this <a href="http://jsfiddle.net/fkQwU/" rel="nofollow"><strong>FIDDLE</strong></a></p>
  
  <p>Database</p>
  
  <pre><code>id   name    section
   1   item1      0
   2   item2      0
   3   item3      0
   4   item4      0
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code> &lt;!-- Items are dynamically inserted into ULs based on section #, unique ids become li id --&gt;
      &lt;!-- DATA = 0 --&gt;
      &lt;ul id="main" class="sortable" data="0"&gt;
          &lt;li id="1"&gt;Item 1&lt;/li&gt;
          &lt;li id="2"&gt;Item 2&lt;/li&gt;
          &lt;li id="3"&gt;Item 3&lt;/li&gt;
          &lt;li id="4"&gt;Item 4&lt;/li&gt;
      &lt;/ul&gt;
      &lt;!-- DATA = 1 --&gt;
      &lt;ul id="box1" class="sortable" style="background-color: blue" data="1"&gt;
  
      &lt;/ul&gt;
      &lt;!-- DATA = 2 --&gt;
      &lt;ul id="box2" class="sortable" style="background-color: green" data="2"&gt;
  
      &lt;/ul&gt;
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <p>after a drag event has completed im trying to call a function that runs a php script to update the DB but im having an issue with passing the ID variable through</p>
  
  <pre><code>$('.sortable').sortable({
      connectWith: '.sortable',
      update: function(event, ui) {
          //Get id of element moved and the id of ul it was dropped in 
          updateDB(updateid, sectionid);
      }
  });
  
  function updateDB(updateid, sectionid) {
      $.ajax({
         //grab script, pass id and update database 
      });
  }
  </code></pre>
  
  <p><strong>Can someone point me in the right direction on how to grab the data so I can update the db properly</strong></p>