title: Post JSON array to mvc controller
body: <p>I'm trying to post a JSON array to an MVC controller. But no matter what I try, everything is 0 or null. </p>
  
  <p>I have this table that contains textboxes. I need from all those textboxes it's ID and value as an object.</p>
  
  <p>This is my Javascript:</p>
  
  <pre><code>$(document).ready(function () {
  
      $('#submitTest').click(function (e) {
  
          var $form = $('form');
          var trans = new Array();
  
          var parameters = {
              TransIDs: $("#TransID").val(),
              ItemIDs: $("#ItemID").val(),
              TypeIDs: $("#TypeID").val(),
          };
          trans.push(parameters);
  
  
          if ($form.valid()) {
              $.ajax(
                  {
                      url: $form.attr('action'),
                      type: $form.attr('method'),
                      data: JSON.stringify(parameters),
                      dataType: "json",
                      contentType: "application/json; charset=utf-8",
                      success: function (result) {
                          $('#result').text(result.redirectTo)
                          if (result.Success == true) {
                              return fase;
                          }
                          else {
                              $('#Error').html(result.Html);
                          }
                      },
                      error: function (request) { alert(request.statusText) }
                  });
          }
          e.preventDefault();
          return false;
      });
  });
  </code></pre>
  
  <p>This is my view code:</p>
  
  <pre><code>&lt;table&gt;
          &lt;tr&gt;
              &lt;th&gt;trans&lt;/th&gt;
              &lt;th&gt;Item&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
          &lt;/tr&gt;
  
          @foreach (var t in Model.Types.ToList())
          {
              {
              &lt;tr&gt;
                  &lt;td&gt;                  
                      &lt;input type="hidden" value="@t.TransID" id="TransID" /&gt;
                      &lt;input type="hidden" value="@t.ItemID" id="ItemID" /&gt;
                      &lt;input type="hidden" value="@t.TypeID" id="TypeID" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
             }
          }
  &lt;/table&gt;
  </code></pre>
  
  <p>This is the controller im trying to receive the data to:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Update(CustomTypeModel ctm)
  {
  
  
     return RedirectToAction("Index");
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>