I have a piece of code that fetches results from my DB and then shows it on my page via jQuery:
var searchItem = function() {
$('#search_results').css('top', '0px');
$.getJSON('/json/searchitem/q/' + $('#json_search').val(), function(data){
$('#search_results ul').fadeIn().html('');
if($('#search_results table').css('display')=='none'){
$('#search_results table').fadeIn();
}
$.each(data, function(i,item){
$('#search_results').append('<tr><td>'+item.code+'</td></tr>');
});
});
};
Now, what I want is when my results are > 10 I want to show it in a table with small rows, 5 to 10 results in a normal table result and < 2 in big divs.
Can anyone point me in the right direction on how to do this count? I'm not experienced in JQuery yet.