title: Check a checkbox if variable is equal to string
body: <p>I am displaying a checkbox in a modal dialog. I use ajax to retrieve a database model with one of the variables returned being <code>data.admin</code>. When this variable equals the string "A" the checkbox must be shown as checked. Otherwise it should remain unchecked.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>&lt;div class="custom-control custom-checkbox"&gt;
         &lt;input type="checkbox" class="custom-control-input" id="admin" name="admin"&gt;
         &lt;label class="custom-control-label" for="admin"&gt;Admin&lt;/label&gt;
  &lt;/div&gt; 
  
  $(document).on('click', '.edit_data',function(){
      var id_code = $(this).attr("id");
      $.ajax({
          url:"edit.php",
          method:"post",
          data:{id_code:id_code},
          datatype:"json",
          success:function(data){
              $('#code').val(data.code);
              $('#login').val(data.login);
              $('#pass').val(data.pass);
              $('#admin').val(data.admin);
              $('#id_code').val(data.id);
              $('#myModale').modal("show");  
          }
      });
  });     
  </code></pre>