My JS
for (var i=0; i<result.length ;i++) {
var selectValue = $("#ProductCode option[value=" + result[i].PRODUCT_CODE + "]").text();
html += '<tr id="tr-'+tblcounter+'" class=""><td class="pc">'
+ selectValue
+ '</td><td class="oc">'
+ result[i].ORDER_QTY
+ '</td><td class="oc">'
+ result[i].DELIVERY_QTY
+ '</td><?php if($usertype == "ANE"){?><td class="oc">'
+ result[i].RECIEVED_QTY
+ '</td><?php } ?><td class="operations"><a href="#" class="editlines" id="'+result[i].LINE_NUMBER+'" onClick="editRow(this);"><img src="<?php echo $this->baseUrl(); ?>/images/edit_icon.png" height="20px" width="20px"></a>'
+ '</td></tr>';
tblcounter++;
}
$('#recvLines').append(html);
In the above table I need to display the last column if my Javascript condition satisfies, otherwise I dont want to display it.
For example
+ '</td><?php } ?>'+if("something" == "something")+'<td class="operations"><a href="#" class="editlines" id="'+result[i].LINE_NUMBER+'" onClick="editRow(this);"><img src="<?php echo $this->baseUrl(); ?>/images/edit_icon.png" height="20px" width="20px"></a>'
+ '</td></tr>';
If I write the if condition like above the code is not working. Any ideas?? Thanks