Created the cicle to correctlycheck each block

P.S. Still getting the $.ajax error