-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
jQuery 2.0 Development Cookbook
By :
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.
Learn how to handle AJAX errors by carefully performing the following steps:
Add the following HTML code to create a simple web page with a single button that will trigger an AJAX request:
<!DOCTYPE html>...
Change the font size
Change margin width
Change background colour