title: How to load a partialview with an int array use jquery in asp.net mvc
body: <p>I use this code to get checked date,but it's not get the int[] value. Where is wrong.</p>
  
  <p><em><strong>View Page:</em></strong></p>
  
  <pre><code>        function displayCheckedPersons() {
          var $checkedRecords = new Array();
          var j;
          j = 0;
             var nodes = $("#PersonTree").jstree("get_checked",null,true); 
             $.each(nodes, function (i, element) {
                 if ($(element).attr("ifPerson") == "Y") {
                     $checkedRecords[j] = $(element).attr("id");
                     j = j + 1;
                 };
             });
  
         if ($checkedRecords.length &lt; 1) {
              alert('Please Select Persons first.');
              return;
          }
  
  
          $('#result').load('&lt;%= Url.Action("DisplayCheckedPersons", "Scheduling") %&gt;',$checkedRecords);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><em><strong>Action Code:</em></strong></p>
  
  <pre><code>        public ActionResult DisplayCheckedPersons(int[] checkedRecords)
      {
          AttendMSDataContext db = new AttendMSDataContext();
          checkedRecords = checkedRecords ?? new int[] { };
          return PartialView("CheckedPersons", db.Persons.Where(o =&gt; checkedRecords.Contains(o.id)));
      }
  </code></pre>
  
  <p>Edit by dai:
  I used $ajax to post the array,like this:</p>
  
  <pre><code> $.ajax({
              type: "POST",
              url: "&lt;%= Url.Action("DisplayCheckedPersons", "Scheduling") %&gt;",
              data: { checkedRecords: checkedPersons },
              dataType: "html",
              success: function (request) { $("#result").html(request); },
              traditional: true
          });
  </code></pre>