Change in behavior: Send error response as JSON string if AJAX request is detected