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?

```js
$('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<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]);
                                }
                        }
                     });

                 });
```