Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Using Ajax with WebSphere Commerce

Marco Deluca (madeluca@ca.ibm.com), Solution Architect, IBM Canada
Marco Deluca

Marco Deluca is a Business Solution Architect with the WebSphere Commerce Solution Enablement team and has five years of experience developing and creating solutions for WebSphere Commerce.


(An IBM developerWorks Contributing Author)
Frances Mullally (mullally@ca.ibm.com), Information Developer, EMC

Frances Mullally is an Information Developer with WebSphere Commerce. She has experience in the electronic commerce, retail, and health care industries as a technical writer and trainer.

Summary:  This tutorial provides a quick series of tasks to use Ajax technology with WebSphere® Commerce. It also provides instructions on how to enable dynamic caching with Ajax using the full test environment.

Date:  12 Jul 2006
Level:  Intermediate PDF:  A4 and Letter (1088 KB | 19 pages)Get Adobe® Reader®

Activity:  6583 views
Comments:  

Introduction

Asynchronous JavaScript and XML (AJAX) is a group of technologies used together as a Web development technique for creating interactive Web applications. With Ajax, instead of loading a Web page, a browser loads an Ajax engine (written in JavaScript), which displays the page the user sees, and then communicates with the server. The Ajax engine allows a user's interaction with the application to happen simultaneously, irregardless of the actions of the server.

When used with WebSphere Commerce, Ajax eliminates the time customers spend staring at a browser window and an hourglass icon, waiting for the server to do something. A customer makes their request through the browser and the Ajax engine responds and gets the information from the WebSphere Commerce Server. This tutorial provides widgets developers can use to enhance the functionality of their WebSphere Commerce v5.6.1 application. The tutorial provides instructions on how to enable dynamic caching with Ajax using the full test environment.

This tutorial shows examples where you can use Ajax with WebSphere Commerce. The examples display simple and complex scenarios where Ajax is used to serve customers better by eliminating page refresh, providing customers with immediate results:

  • Scenario one - Menu population
  • Scenario two - Credit check
  • Scenario three - Quick SKU lookup

Through the scenarios, you will see how display (css) and Java script are used to invoke instantaneous server calls without traditional Web page refreshing. Caching Ajax requests for performance improvement is also examined. Note: The scenarios in this tutorial may not directly apply to your business needs. The aim of this tutorial is to provide a sample package to form the basis for your Ajax implementations.

Scenario one - Menu population

This scenario displays how to populate a menu given user input. When a country or region is selected, the state or province dropdown menu is populated via an Ajax call to the server to retrieve the state or province names within the selected country. If your store only services one or two countries, it is more efficient to bypass an Ajax call altogether and load all state/provinces on the initial page load. Caching is demonstrated in this example to speed up performance. Figure 1 shows the State/Province field instantaneously displaying options once a Country/Region has been selected.


Figure 1. Menu population
Menu population

Scenario two - Credit check

This scenario demonstrates a smooth and friendly way to inform your user to wait while you retrieve data for them from a backend system. Web Service and MQ messaging calls are not always instantaneous and require users to wait. In the traditional method, a user clicks a link and waits for a synchronous message to be sent and received before the Web page returns to the user. During busy times, requests may take longer then expected, which can prompt users to click the Refresh button on their browser. This causes the server to handle yet another request, and slows down the process. In this scenario, the Web page is redrawn and instantaneously informs the user to wait. Next, a request is issued to the MQ server to get data (in this case, Credit data) for a particular user. When the result returns, it is instantly displayed. If a set timeout or error occurs, an error message and refresh button are displayed to the user. Figure 2 shows what a customer will see when their credit check information is being retrieved from the server.


Figure 2. Credit check
Credit check

Scenario three - Quick SKU lookup

This scenario is more complex and applicable to smaller catalogs. In this scenario, the user types in two characters (configurable #) into the SKU text area, and an Ajax call is made to assist the user in finding the SKU. Each extra character entered narrows the list of SKUs without further requests being made to the server. These lookup results are cached for performance. Figure 3 shows the options customers will see when they enter in partial SKU number.


Figure 3. Quick SKU lookup
Quick SKU lookup

1 of 9 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=145803
TutorialTitle=Using Ajax with WebSphere Commerce
publish-date=07122006
author1-email=madeluca@ca.ibm.com
author1-email-cc=
author2-email=mullally@ca.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers