Ajax handler for an iterative request to the server