title: Jquery, add value to array in each loop
body: <p>I have a jQuery app where the user can add items to a list from an input field.
  I want to put all items in an array when you submit the form so I can manipulate them with php later. Is this the right way to do it?</p>
  
  <p>jQuery:</p>
  
  <pre><code>$("#form").submit(function(){
     var items = [];
     $("#items li").each(function(n){
        items[n] = $(this).html();
     });
     $.post(
        "process.php", 
        {items: items}, 
        function(data){
            $("#result").html(data);
        });
  });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$items = $_POST["items"];
  foreach($items as $item){
      //Something here
  }
  </code></pre>