title: Pass an array of strings from view to controller
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7116099/send-array-to-mvc-controller-via-json">Send array to MVC controller via JSON?</a>  </p>
  </blockquote>
  
  
  
  <p>I haven't really found a good solution to this so far.</p>
  
  <p>My javascript/jQuery and I try to send the data using ajax.</p>
  
  <pre><code>    var val = new Array();
      $( ':checkbox:checked' ).each( function ( i )
      {
          console.log( $( this ).val() );
          val[i] = $(this).val();
      });
      removeSelected(val);
  
  
  function removeSelected(listOfStuff)
  {
      $.ajax({
          url: '@(Url.Action("removeSelected"))',
          type: 'POST',
          data: { listOfStuff: listOfStuff },
          dataType: 'json',
          success: function ( return_data )
          {
              $( ":checkbox:checked" ).closest('tr').remove();
          }
      });
  </code></pre>
  
  <p>And my controller. The array comes in as null.</p>
  
  <pre><code>    [HttpPost]
      public bool removeSelected ( string[] listOfStuff )
      {
         //do stuff
      }
  </code></pre>
  
  <p>Any suggestions?</p>