ajax logic implemented