title: Select checkbox - > click button - > update table values
body: <p>initially values under <strong>reattempt column</strong> will be blank . Once we select checkboxes of some rows and click on button <strong>reattempt</strong> , i want to update the values of <code>column reattempt</code> to reattempt.</p>
  
  <p><a href="https://i.stack.imgur.com/8LwUe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8LwUe.png" alt="enter image description here"></a></p>
  
  <p><strong>html</strong></p>
  
  <pre><code>&lt;button id="reattempt"&gt;reattempt&lt;/button&gt;
  
  &lt;tr&gt; 
      &lt;th class="table-header"&gt;Reattempt&lt;/th&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
      &lt;td id="&lt;?php echo $orderrecords[$k]["tracking_id"];?&gt;reattempt"&gt;
          &lt;?php echo $orderrecords[$k]["reattempt"]; ?&gt;       
      &lt;/td&gt;
  &lt;/tr&gt; 
  </code></pre>
  
  <p><strong>script</strong></p>
  
  <pre><code>$('#reattempt').click(function() {
    var selected = [];
    $('.assigneeid-order:checked').each(function() {
      selected.push($(this).val());
      $('.assigneeid-order').prop('checked', false);
    });
  
    var jsonString = JSON.stringify(selected);
  
    $.ajax({
      type: 'POST',
      url: 'reattempt.php',
      data: { data: jsonString },
      success: function(response) {
        response = $.parseJSON(response);
  
        $.each(response, function(index, val) {
          $('#' + index + '').html(val);
          $('#' + index + 'reattempt').html(val.reattempt);
        });
      }
    });
  });
  </code></pre>
  
  <p><strong>reattempt.php</strong></p>
  
  <pre><code>$data = json_decode(stripslashes($_POST['data']));
  
  foreach($data as $id)
  { 
      $orderid = $id; 
      $reattempt='';
  
      $sqlecom = "UPDATE do_order set reattempt = '$reattempt' where tracking_id=".$orderid;
      $db_handleecom = new DBController(); 
      $resultecom = $db_handleecom-&gt;executeUpdate($sqlecom); 
  
      $response[$orderid] = [ 'reattempt' =&gt; $reattempt ];
  }
  
  echo json_encode($response);
  </code></pre>
  
  <p><strong>Result</strong></p>
  
  <p>Values not updating , below is response :</p>
  
  <p><a href="https://i.stack.imgur.com/iaSPo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iaSPo.png" alt="enter image description here"></a></p>