split out all ajax functions