ajax funcionality for responses