display error codes instead of raw HTML data when errors occur in ajax requests