I haven’t broken radio silence in a while so I thought I would have a general discussion of some of the fun code I’ve been exploring. OPAC development has been interesting as of late in part because of its evolution into an almost fully dynamic client side application. Our extensive use of JSON and XMLHTTPRequest gives us this ability to make the site more dynamic and is also a reason in itself why the OPAC has been a joy to code.
Traditional web pages typically use forms for submitting data to a server. Javascript often plays the role of form validator. JS is also good at making a page appear more interesting and dynamic (e.g. DHTML – moving/populating HTML elements dynamically). With the emergence of XMLHTTPRequest (or AJAX), it is no longer necessary to submit a form and download another web page to see the results of the submission. The form data can be analyzed by the javascript and submitted to the server for processing. The server can then respond with some data at which point the javascript can dynamically add the received data to the page (e.g. shove data into a table, etc.). With this simple addition, Javascript has evolved from “helper” code to full blown application code, so much so that you could write a fully functional web site that only has a single web page accompanied by a collection of javascript files that perform all of the work.