title: Get value from input textbox inside table and send to json stringify
body: <p>This form grabs the input of the userID to get the list of vehicles assigned, then user will need to enter the mileage of each vehicle displayed in the table and the list will be saved with the mileage entered, the problem that I'm having is I cannot grab the mileage that I need to send to the database, the stringify comes "" when I send it to the codebehind. I'd appreciate any suggestions or pointing to the right direction. </p>
  
  <p>--Javascript--</p>
  
  
  
  <pre><code>&lt;script type="text/javascript" src="Scripts/jquery.tabletojson.min.js"&gt;&lt;/script&gt;
  
  
  
  &lt;script type="text/javascript"&gt;
   //Get the User ID input
  
      $(document).ready(function () {
          $('#btnSearch').click(function () {
              // alert("something");
  
              userInfo();
          });
  
          function userInfo() {
              var elem_id = $("#txtIBMEntry").val();
              var page_url = "MileageEntry.aspx/GetServices";
              $.ajax({
                  type: "POST",
                  url: page_url,
                  data: "{'IBM':'" + elem_id + "'}",
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (userDetails)
                  { $("#infoDisplay").html(userDetails.d); }
  
              });
  
              //return false;
          };
  
  
          $('#btnSave').click(function () {
  
              // alert("This is going to activate the save procedure");
  
              setVehicleMileage();
  
          });
  
          function setVehicleMileage() {
  
              var page_urlSave = "MileageEntry.aspx/SetVehicleMileage";
              //var tbl = $('#results tr');
              var tbl = $('#results').tableToJSON();
              var table = JSON.stringify(tbl);
  
  
              $.ajax({
                  type: "POST",
                  url: page_urlSave,
                  data: "{'tbl':'" + table + "'}",
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (userDetails1)
                  { $("#infoDisplay").html(userDetails1.d); }
  
              });
              //alert(JSON.stringify(table));
  
  
          };
  
      });
  
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>this is how I load the html table, I'm using the same code to display the textboxes to enter mileage</p>
  
  <pre><code>   Public Shared Function GetString(ByVal IBM As String)
      'vb code 
     Dim ds As New DataSet
  
      IBM = Right("00000" &amp; IBM, 5)
  
      ds = DBMgr.GetAssignedVeh(IBM)
  
      Dim table As DataTable = New DataTable()
      table = ds.Tables(0)
  
      Dim drows As DataRowCollection = table.Rows
      Dim HTML As StringBuilder = New StringBuilder
      ' HTML.AppendLine("&lt;table&gt;")
  
      If drows.Count &gt; 0 Then
  
          HTML.Append("&lt;table id='results' style='border-width:1; border-color:Silver; border-style:solid; padding:4;'&gt;")
          HTML.Append("&lt;thead&gt;")
          HTML.Append("&lt;tr&gt;&lt;th&gt;Name/IBM&lt;/th&gt;&lt;th&gt;Vehicle &lt;/th&gt;&lt;th&gt;Vehicle Number&lt;/th&gt;&lt;th&gt;Mileage&lt;/th&gt;")
          HTML.Append("&lt;/tr&gt;")
          HTML.Append("&lt;/thead&gt;")
  
  
          For Each dr As DataRow In drows
              HTML.Append("&lt;tbody&gt;")
              HTML.AppendLine("&lt;tr&gt;")
              HTML.AppendFormat("&lt;td&gt;{0}&amp;nbsp&amp;nbsp&lt;/td&gt;" &amp; vbLf, dr("AssignedIBM"))
              HTML.AppendFormat("&lt;td&gt;{0}&amp;nbsp&amp;nbsp&lt;/td&gt;" &amp; vbLf, dr("VehicleName"))
              HTML.AppendFormat("&lt;td&gt;{0}&amp;nbsp&lt;/td&gt;" &amp; vbLf, dr("VehNum"))
              HTML.AppendFormat("&lt;td&gt;{0}&amp;nbsp&lt;input id='txtMileageEntry'/&gt;&lt;/td&gt;" &amp; vbLf, "")
              HTML.AppendLine("&lt;/tr&gt;")
  
  
          Next
          HTML.AppendLine("&lt;tr&gt;")
          HTML.AppendLine("&lt;td colspan=3&gt; &lt;/td&gt;")
          HTML.AppendLine("&lt;td&gt;&lt;/td&gt;")
          HTML.AppendLine("&lt;/tr&gt;")
      HTML.Append("&lt;/tbody&gt;")
          HTML.AppendLine("&lt;/table&gt;")
          'HTML.AppendLine("&lt;/div&gt;")
          '&lt;input type='button' id='btnSave1' value='Save Mileage' /&gt;
  
      Else : HTML.AppendLine("&lt;label id='lblMessage'style='color:Red ;' &gt;IBM Entered does not match any records, Please try again.&lt;/label&gt;")
  
      End If
  
      Return HTML.ToString
  
  
  End Function
  </code></pre>