title: Mvc5 getting data list from controller to ajax function c#
body: <p>i am getting data list from controller to ajax function to my datatable.all works well but my question is, I want to get one of list property to textbox and other values to datatable columns.for example:
  list= TotalAMount,PAidAmount,RemAmount
  and datatable 
  Totalamount| PaidAMount | RemAmount|    ---------??
  20         | 4          | 16       |</p>
  
  <p>so this works fine but i want to get TotalAmount value to some textbox also like textbox=20.
  my JS function==>>
  ` 
  function AddGetHistoryView(SupplierID) {</p>
  
  <pre><code>            $('#HistoryModal').modal('show');
  
              Datatabless = $("#HistoryTable").DataTable({
                  "autoWidth": false,
  
  
                  "ajax": {
                      "type": "GET",
  
                      "url": "@Url.Action("getHistoryData", "Supplier")/" + SupplierID,
                      "datatype": "JSON",
  
                      data: {
                          "Amount": $("#TotalAmount").val()
  
  
                      },
                      data: { SupplierID: SupplierID },
  
  
  
  
  
  
                  },
  
  
                  "columns": [
  
                      {
                          "data": "DetailID",
                          "visible": false,
  
                      },
                      {
                          "data": "TotalAmount",
  
                          "width": "5%",
                      },
  
                      {
                          "data": "PaidAmount",
                          "width": "5%",
                      },
                      {
                          "data": "RemAmount",
                          "width": "5%",
                      },
                      {
                          "data": "PaidDate",
                          "width": "5%",
  
                      },
                      {
                          "data": "PaymentType",
                          "width": "5%",
                      },
  
                      {
  
  
                          "data": "DetailID", "render": function (data) {
                              return "&lt;a class='btn btn-success' onclick=EditRow(" + data + ") style='margin-left:12px'&gt;&lt;i class='glyphicon glyphicon-edit'&gt;&amp;nbsp;Update&lt;/i&gt;&lt;a/&gt;,&lt;a class='btn btn-danger' onclick=deleteRow(" + data + ") style='margin-left:12px'&gt;&lt;i class='glyphicon glyphicon-trash'&gt;&amp;nbsp;Delete&lt;/i&gt; &lt;a/&gt;";
  
                          },
  
                          "width": "40%",
                          "orderable": false,
  
                          "pagingType": "full_numbers",
                          "paging": true,
  
  
                      },
  
  
  
                  ],
  
  
  
  
  
              });
  
  
  
  
          }
  </code></pre>
  
  <p>`
  Controller Method==></p>
  
  <pre><code> public ActionResult getHistoryData(int SupplierID)
      {
          ob.Configuration.ProxyCreationEnabled = false;
  
          var data = ob.Table_Supplier.Join(ob.Table_SupplierDetails, sup =&gt; sup.SupplierID, det =&gt; det.SupplierID, (sup, det) =&gt; new
          {
              DetailID=det.DetailID,
              SupplierID = sup.SupplierID,
              TotalAmount = det.TotalAmount,
              RemAmount = det.RemAmount,
              PaidAmount = det.PaidAmount,
              PaidDate = det.PaidDate,
              PaymentType = det.PaymentType,
              Amount = sup.Amount
  
  
          }).Where(x=&gt;x.SupplierID==SupplierID).ToList();
  
  
          return Json(new { data = data }, JsonRequestBehavior.AllowGet);
      }
  </code></pre>