tidy up ajax function, no need for old ie support