title: Pass Comma Separated Value to ASP.NET MVC Action Method
body: <p>Ok so I basically have an ajax call retrieving values from html select multiple tag ... Thing is I'm not able to pass these values into my controller (I'm getting a null reference in my controller) </p>
  
  <p>Check <code>types: $('select#opt2').val()</code> in the ajax call. <code>avion: $('select#opt1').val()</code> isn't a multiple values so it works fine. When I <code>alert($('select#opt2').val())</code> I get values like: GC,VSG,AA7... (They are separated by ",")</p>
  
  <p>Here's my code:</p>
  
  <p><strong>AJAX</strong></p>
  
  <pre><code>$('select#opt2').change(function () {
              $.ajax({
                  url: '@Url.Action("RetournerPostes", "Home", new { area = "Avion" })',
                  data: { avion: $('select#opt1').val(), types: $('select#opt2').val() },
                  type: 'POST',
                  dataType: 'JSON',
              //Rest of code
  </code></pre>
  
  <p><strong>CONTROLLER</strong>
  This is where I get the null reference for variable "types"</p>
  
  <pre><code>[HttpPost]
      public async Task&lt;ActionResult&gt; RetournerPostes(string avion,List&lt;string&gt; types)
      {
         //Rest of action
  </code></pre>
  
  <p>Tell me if you need any more information. Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Added fiddle: <a href="https://jsfiddle.net/f73jxo5v/" rel="nofollow noreferrer">https://jsfiddle.net/f73jxo5v/</a></p>