make all ajax call into it's own funciton