code from ajax class