Seeing how there is liitle/no activity on the Ajax forum, I am reposting this here:
Gents;
I've been struggling with this for literally months and cannot seem to get a handle on it. I am a seasoned developer but not that familiar with js. I've spent the last several days (yes - many, many days over months) searching for examples and have found many but not what I believe would be a simple solid example.
I am trying to use the onchange attribute of an html <select> statement so the selected item will trigger a js script to communicate with a server via XMLHttpRequest then accept the returned content and populate a target select section.
I do have a working host module that returns a json encoded string with the desired content. In fact, here it is:
{"*A":"*ALL","C5":"Cash 5","L":"Classic Lotto","P3E":"Play 3","P3M":"Midday 3","P4E":"Play 4","P4M":"Midday 4","PB":"Powerball"}
I've played with many many variations of js code in my test php program/js content without success.
I am HOPING that someone here can reference a simple set of js scripts that will:
1) generate an XMLHttpRequest based on the value selected by the user on the first select/option set;
2) parse the returned json content and re-populate the target select/option set then enable the select itself.
Someone, somewhere must have this logic or at least know where to find good examples?
I do have several javascript books as well as access to much online js content. And, an example is worth a thousand words (or days in my case).
Thanks to ANYONE who can provide this example or a reference thereof.
B ponder
Gents;
I've been struggling with this for literally months and cannot seem to get a handle on it. I am a seasoned developer but not that familiar with js. I've spent the last several days (yes - many, many days over months) searching for examples and have found many but not what I believe would be a simple solid example.
I am trying to use the onchange attribute of an html <select> statement so the selected item will trigger a js script to communicate with a server via XMLHttpRequest then accept the returned content and populate a target select section.
I do have a working host module that returns a json encoded string with the desired content. In fact, here it is:
{"*A":"*ALL","C5":"Cash 5","L":"Classic Lotto","P3E":"Play 3","P3M":"Midday 3","P4E":"Play 4","P4M":"Midday 4","PB":"Powerball"}
I've played with many many variations of js code in my test php program/js content without success.
I am HOPING that someone here can reference a simple set of js scripts that will:
1) generate an XMLHttpRequest based on the value selected by the user on the first select/option set;
2) parse the returned json content and re-populate the target select/option set then enable the select itself.
Someone, somewhere must have this logic or at least know where to find good examples?
I do have several javascript books as well as access to much online js content. And, an example is worth a thousand words (or days in my case).
Thanks to ANYONE who can provide this example or a reference thereof.
B ponder