fix up ajax function and syntax