ajax functions and A/C button logic