new approach to mirror jQuery ajax function