jQuery List DragSort PHP Example
Homepage Save list order with ajax:
$list = array("blue", "orange", "brown", "red", "yellow", "green", "black", "white", "purple");
for ($idx = 0; $idx echo "- ";
echo "" . $list[$idx] . "
";
echo " ";
}
?>
" });
function saveOrder() {
var data = $("#gallery li").map(function() { return $(this).data("itemid"); }).get();
//通过ajax模拟post的方式,post格式形式为:[0, 1, 2, 5, 4, 3, 8, 6, 7]
$.post("example.php", { "ids[]": data });
};