I'm trying to get an if else statement to work in Javascript. This was the original code (without if statement) and it's working:
html += "<td><a href='"+item['UrlBuyer']+"' target='blank'>"+item['ID']+"</a></td>"+
"<td>"+item['ImportDatum']+"</td>"+
"<td>"+item['ReceiptLimitDate']+"</td>"+
My idea was to add an if/else statement on the first line. If the field UrlBuyer is null, then don't make a href link.
Something like below, but it's not working.
html += if(item['UrlBuyer'] == null){
"<td><a href='"+item['UrlBuyer']+"' target='blank'>"+item['ID']+"</a></td>"+
} else {"<td>"+item['ID']+"</td>"+
}
"<td>"+item['ImportDatum']+"</td>"+
"<td>"+item['ReceiptLimitDate']+"</td>"+