title: Controller gets {int[0]} from View instead array of Ids?
body: <p>I have View that contains an Ajax call that should send the checkboxes selected to the controller. What am getting is <code>{int[0]}</code> instead of an array of ids. How would I pass the ids to my controller?</p>
  
  <p>I've tried adding <code>name</code> to the input checkboxes, thinking would bind to array, but no go.</p>
  
  <p>JavaScript:</p>
  
  <pre><code>$("#sendSubEvents").submit(function (event) {
  
                  //event.preventDefault();
  
                  var action = $(this).attr('action');
                  var idSelector = function () { return this.id; };
                  var subEventsChecked = $(":checkbox:checked:not(#wdn_menu_toggle)").map(idSelector).get();
                  var checked = { 'subEventsChecked': subEventsChecked };
                  //Shows selected for testing.
                  //alert("Sending selection: " + subEventsNotChecked);
  
                  $.ajax({
                      url: action,
                      type: 'POST',                    
                      data: checked,
                      success: function (response) {
                          if (response) {
                              alert("Event selection successfully saved.");
                          }
  
                      }
  
                  });
              })
  </code></pre>
  
  <p>;</p>
  
  <p>HTML Form:</p>
  
  <pre><code>&lt;form id="sendSubEvents" asp-action="AttendSubEvent" asp-controller="Ambassador" method="post"&gt;
              @Html.HiddenFor(x =&gt; x.SubEvents)
              &lt;table id="subEventsTable"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Event Name&lt;/th&gt;
                          &lt;th&gt;Sub Event Name&lt;/th&gt;
                          &lt;th&gt;Description&lt;/th&gt;
                          &lt;th&gt;Date&lt;/th&gt;
                          &lt;th&gt;Start Time&lt;/th&gt;
                          &lt;th&gt;End Time&lt;/th&gt;
                          &lt;th&gt;Location&lt;/th&gt;
                          &lt;th&gt;Available&lt;/th&gt;
  
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      @foreach (var ev in Model.SubEvents.OrderBy(x =&gt; x.SubEventName))
                      {
                          &lt;tr&gt;
                              &lt;td&gt;@ev.EventName&lt;/td&gt;
                              &lt;td&gt;@ev.SubEventName&lt;/td&gt;
                              &lt;td&gt;@ev.SubEventDescription&lt;/td&gt;
                              &lt;td&gt;@ev.Date.ToShortDateString()&lt;/td&gt;
                              &lt;td&gt;@DateTime.Today.Add(ev.StartTime).ToString("hh:mm tt")&lt;/td&gt;
                              &lt;td&gt;@DateTime.Today.Add(ev.EndTime).ToString("hh:mm tt")&lt;/td&gt;
                              &lt;td&gt;@ev.Location&lt;/td&gt;
                              &lt;td&gt;&lt;input name="subEventIds" type="checkbox" id=@ev.SubEventId asp-for="@ev.Attend" /&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                      }
                  &lt;/tbody&gt;
              &lt;/table&gt;
              &lt;br /&gt;
  
              &lt;button type="submit" id="addSubEventsBtn" class="wdn-button wdn-button-complement" style="float:right;"&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>Controller (Action):</p>
  
  <pre><code>[HttpPost]
          [Authorize(Roles = "Ambassador")]
          public IActionResult AttendSubEvent(int[] subEventsChecked)
          {
              var model = new AmbassadorAssociatedSubEventsViewModel();         
  
              _ambassadorManager.AttendSubEvent(subEventsChecked, _userManager.CurrentUser.UserName);
  
              return RedirectToAction(nameof(GetSubEvents));
  </code></pre>
  
  <p>I need to get the selected ids in array to the controller.</p>