OK. I knew from the beggining that it would sound crazy but it does loop because i put it in loop. I knew that the proper solution would be diafol's answer. But i dont know how i could use a for loop since i use $.each( data, function( i, data )in the first place.
if( data.length )
$.each( data, function( i, data )
html = '<span>#'+i+'</span>';