tied up ajax to response functions