Pero sucede que, en la cuarta columna deseo mostrar una imagen, pero quiero que esa imagen se muestre segun una condicion.
Entonces he recurrido a jQuery, creo un div que se llama "type" (en y hago que atraves de la funcion html() se instroduzca un <img> que muestre una imagen determinada.
Pero la imagen se muestra en cualquier lado o a veces no se muestra.
Quisiera saber si esta bien convocada la funcion o cual seria la manera adecuada de hacerlo.
Gracias
El codigo es:
Código PHP:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<?php
echo "<center>";
echo "<table border='0'><tr>
<td><a href='indexDSC.php' target='_self' ><img src='sort.png' width='30' height='30' alt='Ordenar'/></a></td>
<td><a href='javascript:location.reload()' target='_self'><img src='refresh.png' width='30' height='30' alt='refresh'/></a></td>
<td><a href='javascript:window.print(); void 0;' target='_self'><img src='print.png' width='30' height='30' alt='Print'/></a></td>
<td><a href='javascript:window.print(); void 0;' target='_self'><img src='email.png' width='30' height='30' alt='Email'/></a></td>
</tr></table>";
echo "<table border='1' color='black'>";
echo"<tr>
<th>id</th>
<th>Worker</th>
<th>Hashrate</th>
<th>Tipo</th>
</tr>";
$j=1;
$i=0;
foreach($obj['data'] as $item)
{
if ($item['hashrate'] > 100)
{
echo '<tr><td>'.$j.'</td><td>'.$item['worker'].'</td><td><div style="color: #088A29">' .number_format($item['hashrate'] , 3). '</div></td><td> <div id="type"></div> </td></tr>';
if($item['worker']=='minR25PC04')
{
?>
<script>
$( function(){
$('#type').html('<img src="refresh.png" width="30" height="30"/>');
});
</script>
<?
}
}
else {
}
echo "</table>";
echo "</center>";
echo "<hr>";
?>
Como podemos ver en la imagen se lista en cualquier <div>, no responde a la condicion.
https://www.dropbox.com/s/lso2ozi5elt4wza/Captura.JPG?dl=0