title: check multiple checkbox based on database column value using jquery ajax
body: <p>i want to update my formin php using ajax jquery so i load textbox and checkbox value based on data stored in database textbox value is load but how checked checkbox value based on column value?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('body').on('click','.update', function(){
                      var edit_id = $(this).attr('id');
                      var rowElement = $(this).parent().parent(); //grab the row
                   
                      $.ajax({
                          type: 'POST',
                          url: 'update.php',
                          data: 'edit_id='+edit_id,
                          success: function(data) {
                                                     
                             var a=data.split(",");
                             $("#title1").val(a[0]);
                             $("#prod").val(a[1]);
                             $("#dir").val(a[2]);
                             $("#wri").val(a[3]);
                            
                              
                             $("#510").html(a[4]);
                             var g=document.getElementsByName("genre[]");
                             for(var i=0;i&lt;g.length;i++)
                             {    
                             var t=document.getElementsByName("genre[]")[i].value;
                              alert(t);
                             }
                              $("#temp1").val(a[5]);
                              if(g=val(a[4]))
                             {
                                 alert(g);
                             $(".gen").prop("checked", true);
                             }
                              if (data = "true") {
                                  // $("#title1").val(data);
                                  alert("update "+data);
                                  rowElement.add();
                                   }
                              else {
                                  alert("not update");
                                 alert("update"+data[0]);
                                  }
                          }
                       });
             
                   });</code></pre>
  </div>
  </div>
  </p>