I am trying to get the contents of a div and send that to ajax.
Here is a sample code of ajax that sends data but how can I put the html contents of a div in this post and send it to another php script via ajax?
I need to send ALL the HTML in the "sortable" ui and not just the text.
<ul id="sortable">
<li class="ui-state-default">Hello, please send me to Ajax! :)</li>
</ul>
$("button").click(function()
{
$.post("get_sorted_content.php", // Example script
{
data: $("#sortable").html(); // My NEEDED content - Does not work!
function(data)
{
alert("Data: " + data + ");
});
});
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.