In Table, If the cell value of row is "Undelivered" , then I want to hide complete row. Below table is displaying in .php page
Original code :
<tr>
<td><?php echo $orderrecords[$k]["order_id"]; ?></td>
<td>
<?php
$url = 'https://plapi.ecomexpress.in/track_me/api/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$output = curl_exec ($ch);
curl_close($ch);
$res = explode("\n",$output);
echo $res[13];
?>
</td>
</tr>
Initially I tried with CSS as Jsfiddle :
<tr>
<td><?php echo $orderrecords[$k]["order_id"]; ?></td>
<td>
<input type='text' value=
"<?php
$url = 'https://plapi.ecomexpress.in/track_me/api/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$output = curl_exec ($ch);
curl_close($ch);
$res = explode("\n",$output);
echo $res[13];
?> "/>
</td>
</tr>
<style>
input[type='text'][value='Undelivered'] {
display: none;
}
</style>
Than I tried with Javascript as below :
<tr>
<td><?php echo $orderrecords[$k]["order_id"]; ?></td>
<td class="sold">
<?php
$url = 'https://plapi.ecomexpress.in/track_me/api/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$output = curl_exec ($ch);
curl_close($ch);
$res = explode("\n",$output);
echo $res[13];
?>
</td>
</tr>
<script>
$("td.sold").filter(function() {
return +$(this).text().trim() === 'Undelivered';
}).parent().hide();
</script>
Finally I tried with PHP as below, but i did't got solution :
<tr class="<?= $res[13] == 'Undelivered' ? 'hidden' :'';?>">
<td><?php echo $orderrecords[$k]["order_id"]; ?></td>
<td>
<?php
$url = 'https://plapi.ecomexpress.in/track_me/api/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$output = curl_exec ($ch);
curl_close($ch);
$res = explode("\n",$output);
echo $res[13];
?>
</td>
</tr>
Please help me to find solution....