Draconis Software Blog

Maintaining State with AJAX

One of the most difficult parts of writing complex, AJAX-enabled web applications is maintaining state throughout the user experience. Since, by nature, AJAX gives us the ability to do completely unstructured navigation with real-time changes, maintaining state has become increasingly complex.

Recently, I was working on an AJAX-aware process where the user would select from a set of criteria for searching system inventory in a future version of RSP. The tool is designed to allow systems administrators and managers to quickly compare hardware configurations (along with other hardware-related features). In setting the criteria, the user was changing the way a table of hardware configurations was appearing, all in real-time on the same page. One of the difficulties was keeping the state of the user-chosen criteria consistent between page updates.

The solution I came up with was to generate a “state” in Javascript whenever the user changes their set of criteria, then “serialize” this state into a string suitable for POST’ing to the backend (where it’s processed by a Java controller).

(Read the article)

« Older Posts