ajax synchronous method now working