File exits conditional prevented ajax functions from working