title: How to pass multiple values to MVC controller
body: <p>I have a table with various pieces of data. I also have a Html.TextAreaFor for to type text in. Here is the table</p>
  
  <p>I need to capture the text in the Textarea for .. send it to the controller via ajax .post</p>
  
  <pre><code>&lt;table class="table  table-striped table-hover  col-xl-12" id="policyTable"&gt;
  &lt;tr class="thead-dark"&gt;
      &lt;th class="toggleMe1"&gt;
          UnderWriter
      &lt;/th&gt;
      &lt;th class="toggleMe2"&gt;
          @Html.DisplayNameFor(model =&gt; model.Client)
      &lt;/th&gt;
  
      &lt;th&gt;
          Exp-Policies
      &lt;/th&gt;
  
      &lt;th&gt;
          Exp-Date
      &lt;/th&gt;
      &lt;th class="hideMe"&gt;
          Date - Updated
      &lt;/th&gt;
      &lt;th&gt;
          Reviewed-By
      &lt;/th&gt;
      &lt;th&gt;
          Email-Created
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.CAB)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.LossRun)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.MMS)
      &lt;/th&gt;
      &lt;th&gt;
          @Html.DisplayNameFor(model =&gt; model.Notes)
      &lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
  &lt;/tr&gt;
  
  @foreach (var item in Model)
  {
      &lt;tr id="id_@item.Id"&gt;
          &lt;td class="hideMe"&gt;
              @Html.DisplayFor(modelItem =&gt; item.Id, new { id = "VisibleID" })
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.NewUw)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Client)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Expiring_Policies)
          &lt;/td&gt;
  
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.ExpDate)
  
  
  
          &lt;td class="hideMe"&gt;
              @Html.DisplayFor(modelItem =&gt; item.DateUpdated)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.InsertedBy)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.EmailCreated)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.CAB)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.LossRun)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.MMS)
          &lt;/td&gt;
  
          &lt;td style="width: 25%; height: 120px;"&gt;
              &lt;div class="form-group"&gt;
                  @* @Html.LabelFor(model =&gt; model.Notes, htmlAttributes: new { @class = "control-label col-md-2" })*@
                  &lt;div class="col-md-12"&gt;
                      @Html.TextAreaFor(modelItem =&gt; item.Notes, new { @class = "form-control textAreaCS", @rows = 8 })
                      @Html.ValidationMessageFor(modelItem =&gt; item.Notes, "", new { @class = "text-danger" })
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-12 ml-3"&gt;
                  &lt;div class="row"&gt;
                      &lt;input type="submit" value="Save" id="notes" class="btn btn-outline-primary btn-sm col-2" style="font-size: 16px" /&gt;
                      &lt;div class="col-1"&gt;
                          @if (TempData["LB"] != null)
                          {
                              &lt;div class="alert alert-danger text-center text-capitalize" style="font-size: 16px;"&gt;
                                  @TempData["LB"]
                              &lt;/div&gt;
                          }
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Review", "EditPolicy", new { id = item.Id }, new { @class = "review" })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  
  &lt;/table&gt;
  </code></pre>
  
  <p>Here is the ajax call</p>
  
  <pre><code>    var url = "/Policy/CompletedNotes";
          var policyNotes = $("#item_Notes").text();
          var id = $("#VisibleID").val();
          $("input#notes").on('click', function () {
  
              alert(id);
              var data = JSON.stringify({ Id: id, polNotes: policyNotes });
  
              $.ajax({
                  url: '/Policy/CompleteNotes',
                  type: 'POST',
                  contentType: 'application/json',
                  data: data,
                  success: function () {
                      alert('success');
                  }
              });
  </code></pre>
  
  <p>I'm passing the ID of the row and the text in the text box. Here is the controller I'm passing to</p>
  
  <pre><code>  [HttpPost, ValidateInput(false)]
      public ActionResult CompletedNotes(CompletedPolicyVM completedPolicy, string Id, string polNotes)
      {
  
  
          int val = Convert.ToInt32(Id);
  
  
          using (Db db = new Db())
          {
              int id = completedPolicy.Id;
  
  
              NotesDTO notesDTO = db.notes.Find(id);
  
              if (notesDTO == null )
              {
                  return Content("This policy cannot be found." + Id);
              }
  
              //instantiate a stringbuilder variable so I can append the text when inserting in db. 
              var sb = new StringBuilder();
              const char carriageReturn = (char)13;
              const char newLine = (char)10;
              string insertedDate = "Inserted on " + DateTime.Now.ToString("MM/dd/yyyy HH:mm") + " by " + User.Identity.Name;
  
  
              if (notesDTO.Notes == null || notesDTO.Notes == String.Empty)
              {
                  notesDTO.Notes = sb.AppendLine(insertedDate).ToString() + " " + polNotes + "\n";
              }
              else
              {
                  notesDTO.Notes += newLine + sb.AppendLine(insertedDate).ToString() + " " + polNotes + "\n";
              }
  
              db.SaveChanges();
  
  
          }
  
  
          //Save TempData message
          TempData["SM"] = "Policy saved correctly!";
  
          //redirect
          return RedirectToAction("CompletedPolicies");
      }
  </code></pre>
  
  <p>The problem:</p>
  
  <p>Doesn't work. It doesn't pass the values to the controller. It's null every time. I've tried a ton of different ajax calls.. Nothing works. I can capture the Id, but not the text and when it reaches the controller it is null. If these are wrong, how do I simply send the Id of the row.. and the text typed in the textbox to the controller. ?</p>