title: To apply css to the elements retrieved from database based on their value in database
body: <p>Here is what I am trying to do-
  I have a MySQL table with fields namely- clientname, urgent, complete.And for displaying the values for this fields I have a html table with fields- Clientname,urgent and complete.Each row consist of clientname ,button for urgent and button for complete.If you click on the button urgent in a table row then that button's color changes to red and if you again click on that button then it again attains its original color. In short,it toggles between two classes.At that moment ,In the database urgent field value gets updated from 0(initial value) to 1.Now when I reload the page I want to display the urgent button with value 1 in red color.i.e. I want to apply css to the elements based on their value in the database.
  For now I am able to toggle classes to change the color of urgent button on click and update its value but as soon as I refresh the page it again attains its default color.Please let me know how will I be able to retain its color if its value in database is 1 ,even if i refresh the page. 
  This is jquery code-</p>
  
  <pre><code>$(".u").click(function () {
  
    $(this).toggleClass("urgent");
     var ID = $(this).attr('id');
  
  
    $.ajax({
      type:"post",
      url:"urgent.php",
      data:{'keyid': ID},
      cache: false,
  success: function(html){
  
  $("#clientsheet").after(html);
  }  
    });return false; 
  });
  </code></pre>
  
  <p>Html code-</p>
  
  <pre><code> &lt;td style='text-align:center;'&gt;&lt;button  id=".$row['id']." class='u'&gt;U&lt;/button&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Please let me know if you need more info.
  Thanks in advance.
  Edited-
  this is how i am retrieving my html table data from database-</p>
  
  <pre><code> &lt;?php
  include('db.php');
  $fetch= mysqli_query($conn,"SELECT * FROM pendingwork ORDER BY clientname asc");
  
  while($row=mysqli_fetch_array($fetch)){
    $id = $row['id'];
              $newname = $row['clientname'];
              echo "&lt;tr id=".$row['id']."class='edit_tr'&gt;";
                echo " &lt;td class='edit' id=".$id." name=".$newname."&gt;".$row['clientname']."&lt;/td&gt;
                     &lt;td style='text-align:center;'&gt;&lt;button  id=".$row['id']." class='u'&gt;U&lt;/button&gt;&lt;/td&gt;
                     &lt;td&gt;&lt;/td&gt;
                     &lt;td  style='text-align:center;'&gt;&lt;button id=".$row['id']." class='del'&gt;Del&lt;/button&gt;&lt;/td&gt;
              &lt;/tr&gt;";
  }
  </code></pre>