Don't load some classes during ajax events Closes #4282