AJAX Error Handling & Debug Mode Check