no ajax request on empty list

added condition to not poll ajax when the list is empty