Sets up ajax pagination.