Added debugging ajax functions when errors come up