Hi Wayne,
How many possible stores are there. If there's not a lot, then it seems to make more sense to just print out an array of the information in a script on the page.
If you are going to use AJAX though, what is the server-side language you are using? ( php, asp, java, ..)
Here is an example of a the javascript that might be used for your situation:
HTML Code:
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(method, URL) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open(method, URL, true);
xmlHttp.send(null);
}
function handleStateChange() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
processResponse(xmlHttp.responseXML);
}
}
}
function processResponse(response) {
// set your html form from the results here
}
you would need a server script to output xml, or, if JSON is installed, it could output a javascript array format.
in the element that the user selects the store, you will need an
onchange event to call the
startRequest function. the call would look something like this:
HTML Code:
startRequest('GET', 'http://myserver.com/getstoreadress.php?storeid=152');
if the call was being made from a selectbox dropdown, you could assign the store id's to the value of each drop down and just dynamically call this in the select tag like so
HTML Code:
<select name="stores" onchage="startRequest('GET', 'http://myserver.com/getstoreaddress.php?storeid=' + this.value);">
when this is called, it sends the request to the server, and returns xml. ( or text if you use json. ) you need to modify the
processResponse function to parse the xml and set the values of the address fields.
i did not test this code for your situation, but it should be close to what you need. a google search for
ajax resposneXML should turn up plenty of examples of how to parese the returned XML.
keep us updated on the progress.