Got Web Ideas? Fishing for the Answers?
Think Outside The Code First!
Facts, Thoughts, and Opinions About Web Development and Business Strategy
Home Internet FAQ About OTC Contact Us Development & Consulting
Chain Pickerel, Canadice Lake, New York, September 2006
Part II: Examples of Where AJAX is Beneficial
Rob Taylor, Independent Developer & Consultant, TConsult, Inc. www.enginesforwebsites.com
Tuesday, April 01, 2008
To fully see how AJAX can benefit a Website, lets look at some simple examples that seamlessly return data from the database. The examples below are common problems that AJAX can effectively solve or are areas where AJAX can add more user friendly functionality.
1. List Example
First, lets build a list of customers in the database by simply typing in letters of their name. Start typing letters in the box below and watch how the list is generated with matching records.
Find a User By typing the letters of their first name in to the box below

Find Name:

As you can see, as you type in the letters of a user's name, the list grows with matching records. Such a feature can be beneficial when working with a large database that has thousands of records. Returning a complete list of people may be a lot of work and create a heavy page that is hard to navigate.


2. Drop Down Menu Example
The above example may not be ideal if there are thousands of users in the database. If you had 50,000 user records inside of your database then a feature like the one above may not be user friendly. The list could be very long causing a lot of scrolling to find the exact user. How about a drop down menu approach instead? Try this example.
Create a drop down menu of users by typing the letters of their first name in to the box below
Find Name:
That's much nicer. Notice how I returned the number of records found and displayed it in the drop down menu. When using AJAX, one must find ways to do confirmations. Otherwise, without the screen flicker, the user may be left wondering if anything happened.


3. Forum Thread Example
Lets look at one more. Lets say this page was a discussion topic on a community Website. Say we were this far down the page and we wanted to respond to a post made by a member. The user's response would be in the list of all responses and would look something like this. Click the link to respond to John Doe, enter the information requested, and submit the reply. Watch what happens.
Posted By John Doe on Monday, March 31, 2008
I user olive oil when I fry food. Olive oil works the best. Has anyone ever found a better oil to fry food with?
Reply to John Doe's Comments

Notice that screen did not refresh when replying to John Doe's comments. We stayed right where we were in the page. You also saw that I have added an animated saving graphic that appears when the user submits the post. This is required to let the user know that something is happening. On fast connections, this animated dialog box may never appear. But if there is network latency that causes a delay then we need to make sure the user knows that we are processing the post. For this example, I have purposely set the post to delay 5 seconds to make sure you can see the dialog box and understand it's importance.

These are simple examples but I think the advantages to building functionality like this are obvious. AJAX can allow us to take large sets of data and dynamically search them in an easy fashion. It will also allow us to do things near the bottom of a page without the page needing to refresh.

Those are profound areas where an AJAX approach can benefit the end user. However, AJAX also has some disadvantages that should be discussed before one decides to implement AJAX on a wide scale.

More
Scrubbing the Floors with AJAX, But Just Scrubbing Tuesday, April 01, 2008
Part III: Disadvantages of AJAX Tuesday, April 01, 2008



Customized Internet Solutions for Small Businesses and Corporations.
www.enginesforwebsites.com


© 2008 TConsult, Inc. - Engines for Websites
www.enginesforwebsites.com