title: jQuery get div contents and send to php script via ajax
body: <p>I am trying to get the contents of a div and send that to ajax. </p>
  
  <p>Here is a sample code of ajax that sends data but <strong>how can I put the html contents of a div in this post and send it to another php script via ajax?</strong></p>
  
  <p>I need to send ALL the HTML in the "sortable" ui and not just the text.</p>
  
  <pre><code>&lt;ul id="sortable"&gt;
  
  &lt;li class="ui-state-default"&gt;Hello, please send me to Ajax! :)&lt;/li&gt;
  
  &lt;/ul&gt;
  
  
  $("button").click(function()
    {
        $.post("get_sorted_content.php", // Example script
        {
  
         data: $("#sortable").html(); // My NEEDED content - Does not work!
  
       function(data)
         {
  
         alert("Data: " + data + ");
         });
   });
  </code></pre>
  
  <p>Again, This code may be missing some elements but regardless it doesn't work. It's just an example showing what I am trying to do.</p>