Using DWR, the protoype call above can be replaced by a DWR call:
function zipChanged(zip) {
if(zip.length != 5) {
clearCityAndStateFields();
}
else {
// A DWR call. See /WEB-INF/dwr.xml
ZipCodes.getCityAndStateForZip(zip, processZipCodeSelection);
}
}
without having to write a servlet.