In an ideal world, your web application would never go wrong. Unfortunately, this is not the case, and web developers need to gracefully handle errors and provide the user with useful feedback.
For example, system errors occur when a server cannot be reached or a file/web page is missing. System errors are typically unavoidable and out of the user's control. They differ from application errors such as invalid data input, which a user can correct.
Since this recipe deals with AJAX errors and we will be calling a PHP script that does not exist, we only require HTML and JavaScript for this recipe. Create a blank HTML document named recipe-2.html
and ensure that you have the latest version of jQuery downloaded and ready for use.