adding ajax functionality