Your code always fetches all the countries, and just selectively shows certain ones using javascript. The idea of this assignment was to request only the needed countries over AJAX by using offset and limit parameters.