I want to display pdf icon only when the field (WO_doc) is not empty. I don't know what I am doing wrong while writing the if statement. Please help.
<script type="text/javascript">
$( "select[name='PEF_id']").change(function () {
var Pefid = $(this).val();
if(Pefid) {
$.ajax({
url: "<?php echo site_url('Admin/showwo');?>",
dataType: 'Json',
data: {'PEF_id': Pefid},
success: function(response){
$(".displayNone").removeClass("displayNone").addClass("displayHidden");
$.each(response.wo,function(key, value) {
$('.wodata').append('<tr>\
<td>'+value['WO_no']+'</td>\
<td>'+value['WO_date']+'</td>\
<td>'+value['Agency_name']+'</td>\
<td>'+value['WO_amount']+'</td>\
<?php if("?>'+value['WO_doc']+'<?php" != null) { ?>\ ***this if condition is not working***
<td><a href= "<?php echo site_url('/Admin/showwodoc/')?>'+value['WO_doc']+'" target="_blank" <i class="fa fa-file-pdf-o" style="font-size:36px"></i></a></td> <?php } else { ?> <td></td> <?php } ?>\
<td><a href="<?php echo site_url('Admin/edit_wo/')?>'+value['WO_no']+'"><button type="submit" name="submit" class="btn btn-success">Update</button></a></td>\
<td><button type="submit" name="submit" value="'+value['WO_no']+'" class="button-del btn btn-danger">Close this WO</button></td>\
</tr>');
});
}
});
}
});
</script>