title: How to access value of jquery datatable column in order to pass as a parameter to controller
body: <p>I need help getting the value from "media_type" column of my jquery datatable.</p>
  
  <p>Beginning on line 54, I am passing 3 parameters to my controller (id1, id2, id3) when the DELETE button is pressed. Getting the value for the third parameter (id3) from the column on line 18 called "media_type" is where I am stuck. The value will either contain the value "Image" or "PDF". When I put a breakpoint on my controller action (projects/deleteprojectmedia), the value of id3 on Line 56 is blank or null upon entering the controller action.</p>
  
  <p>My feeble attempt is on line 48 and 49:</p>
  
  <pre><code>var currentRow = $(this).closest("tr"); 
  var col2 = currentRow.find("td:eq(1)").text();**
  </code></pre>
  
  <p>but it just isn't working. On Line 50, I put an alert to see what the value might be and it said it is undefined.</p>
  
  <p>Thank you in advance!</p>
  
  <pre><code>            &lt;script type='text/javascript'&gt;
                      $(document).ready(function () {
                        var table = $("#projectmedia").DataTable({
                          ajax: {
                              url: "/projects/getprojectmedia/",
                                          "type": "GET",
                                          "datatype": "json",
                                          data: {
                                              id: "@Model.Projects.Project_Guid"
                                              }},
                                             "columns": [
                                                  {
                                                  data: "project_media_guid",
                                                      render: function (data) {
                                                      return "&lt;a href='/projectmedia/view/" + data + "'&gt;" + "View" + "&lt;/a&gt;";
                                                  }
                                              },
                                          { "data": "media_type", "autoWidth": true },                     
                                          { "data": "media_title", "autoWidth": true },
                                          {
                                          "data": "entered_date",
                                              render: function (data) {
                                              if (data != null) {
                                                  var date = new Date(parseInt(data.substr(6)));
                                                  var month = date.getMonth() + 1;
                                                  return (month.length &gt; 1 ? month : "0" + month) + "/"
                                                      + date.getDate() + "/" + date.getFullYear()
                                                      + "&amp;nbsp;&amp;nbsp;" + (date.getHours() &lt; 10 ? ("0" + date.getHours()) : date.getHours())
                                                      + ":" + (date.getMinutes() &lt; 10 ? ("0" + date.getMinutes()) : date.getMinutes());
                                              } else {
                                                  return "";
                                              }
                                          }
                                      },
                                          {
                                          data: "project_media_guid",
                                              render: function (data) {
                                              return "&lt;button class='btn-link js-delete' data-projectmedia-guid=" + data + "&gt;Delete&lt;/button";
                                          }
                                      },
                                      ]
                                  });
  
                                  $("#projectmedia").on("click", ".js-delete", function () {
                                      var button = $(this);
                                      bootbox.confirm("Are you sure you want to delete this media?", function (result) {
                                          if (result) {
                                              var currentRow = $(this).closest("tr"); 
                                              var col2 = currentRow.find("td:eq(1)").text();
                                              alert(col2);
                                              $.ajax({
                                                  url: "/projects/deleteprojectmedia/",
                                                  data: {
                                                      id: button.attr("data-projectmedia-guid"),
                                                      id2: "@Model.Projects.Project_Guid",
                                                      id3: col2
                                                  },
                                                  method: "DELETE",
                                                  success: function () {
                                                      table.row(button.parents("tr")).remove().draw();
                                                  }
                                              });
                                          }
                                      });
                                  });
                      });
                  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the datatable with the value = "Image" of my Media Type column. When I click the Delete button, I am trying to grab the value of "Image" and pass it as a parameter.
  <a href="https://i.stack.imgur.com/RUGzv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUGzv.jpg" alt="enter image description here"></a></p>
  
  <p>As you can see from my alert, the value I attempted to grab is blank:</p>
  
  <p><a href="https://i.stack.imgur.com/odm6h.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/odm6h.jpg" alt="enter image description here"></a></p>
  
  <p>And finally, when I breakpoint in my controller, you can see the parameter is blank.
  <a href="https://i.stack.imgur.com/zl23d.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zl23d.jpg" alt="enter image description here"></a></p>