adding console.log to ajax working if statement