The idea is sound. It is not entirely clear what your example is filling out itemsnow, but the handler submit, of course, will be called at some point in the future. Is it possible that list items could have been changed by this time?
, "pack the items" submit, :
$("#form").submit(function(){
var items = [];
$("#items li").each(function(n){
items[n] = $(this).html();
});
$.post(
"process.php",
{items: items},
function(data){
$("#result").html(data);
});
});