I'm making a live guest statistics thing for my site and I've recently gotten stuck with this one part of the code.
That should alter the table, although it doesn't.Code:$.each(data, function(i,item){ if(!$('tbody tr td a span span:contains("'+item.ip+'")').length ){ $('<tr class="datar">' + '<td><a href="#" onclick="return false;"><span><span>' + item.ip + '</span></span></a></td>' + '<td><a href=' + item.page + '" class="inlinelink"><span><span>' + item.page.substr(0,40) + '</span></span></a></td>' + '<td><a href="#" onclick="return false;"><span><span>' + item.browser + '</span></span></a></td>' + '<td><a href="#" onclick="return false;"><span><span>' + item.os + '</span></span></a></td>' + '<td><a href="#" onclick="return false;"><span><span>' + refreshes + '</span></span></a></td>' + '</tr>').appendTo("#datatable tbody"); }else{ $('tbody tr td a span span:contains("'+item.ip+'")') .next().html('<a href=' + item.page + '" class="inlinelink"><span><span>' + item.page.substr(0,40) + '</span></span></a>') .next().html('<a href="#" onclick="return false;"><span><span>' + item.browser + '</span></span></a>') .next().html('<a href="#" onclick="return false;"><span><span>' + item.os + '</span></span></a>') .next().html('<a href="#" onclick="return false;"><span><span>' + refreshes + '</span></span></a>'); } });
This is how the table is set-up:
It shows and hides the system message fine.Code:<table cellpadding="0" cellspacing="0" width="100%"> <thead> <tr> <th class="no"><a href="#" onclick="return false;"><span><span>IP Address</span></span></a></th> <th class="no"><a href="#" onclick="return false;"><span><span>Viewing Page</span></span></a></th> <th class="no"><a href="#" onclick="return false;"><span><span>Browser</span></span></a></th> <th class="no"><a href="#" onclick="return false;"><span><span>Operating System</span></span></a></th> <th class="no"><a href="#" onclick="return false;"><span><span>Page Views</span></span></a></th> </tr> </thead> <tbody> </tbody> <tfoot> <tr class="first" id="noclients"> <td colspan="8" width="100%"> <ul class="system_messages"> <li class="white">There are no clients connected</li> </ul> </td> </tr> </tfoot> </table>
Thanks in advance :D


LinkBack URL
About LinkBacks



Reply With Quote
