Making JavaScript Applications Degrade Gracefully with AJAX and MySQL
(Page 1 of 4 )
For many web developers, JavaScript can be the perfect client-side scripting language for turning a boring web site into a bunch of interactive elements. This impressive interactivity comes at a cost in those cases where a web application has been designed to depend entirely on this language for working appropriately. Fortunately, there is a solution; keep reading to learn more.
Introduction
If you want to learn how to solve this issue with relative ease, then this series of articles might be what you're looking for. Welcome to the last installment of the series that began with "Making JavaScript Applications Degrade Gracefully." As the title clearly says, over the course of these three tutorials you'll find concrete examples of how to develop JavaScript applications that degrade gracefully when scripting has been disabled on the browser.
If you already went through the preceding articles of the series, then quite possibly you'll be very familiar with the basic concepts surrounding the development of JavaScript code that has the "ability" to fail transparently under certain client-side conditions. True to form, I demonstrated how to write some basic JavaScript routines aimed at expanding the existing functionality of a specific web application, while keeping its original capacity practically untouched.
This concept is very important in the terrain of web development. When it's applied in conjunction with some others, such as the creation of unobtrusive JavaScript code, it can result in the construction of more robust and independent server-side applications.
Nevertheless, it's quite possible that you already know in detail all of these fundamental concepts, thus I believe that it's time to introduce the topics that I plan to cover in this final article of the series. In this case, I'll be using a step-by-step process to demonstrate how to develop a typical web application that first retrieves some records from a MySQL database, and then displays them straight to the browser.
But the catch here consists of fetching these records via AJAX, which means that no web page reloads will take place. However, if JavaScript has been disabled in the client, users still will be able to visualize the database records in question. Undoubtedly, this is an example where JavaScript can be used to extend the original functionality of a certain web application, but it doesn't affect the way this application works when scripting has been deactivated on the browser.
With the preliminaries out of our way, let's move forward and learn together how to pull some database rows from MySQL via AJAX. It'll be a truly educational experience, trust me!
Next: Fetching database rows using a typical approach >>
More JavaScript Articles
More By Alejandro Gervasio