I’m using AJAX with struts1.x, In my application once select the first select item then second select item will be updated using AJAX. Once i select the second select item it will display the result using AJAX..
Now If the user selects different item of first select items, Then i have to display updated result in Second select items and disappear the previous result caused by second selected item.
Eg. select Country: India
select State: Delhi
Delhi Information will be printed here…
Ajax response
document.getElementById("processStates").innerHTML = xmlHttp.responseText;
document.getElementById("StateInfoDisplay").innerHTML = xmlHttp.responseText;
select country:<select name="countryName"
onchange="showStates(this.value);">
<span id="processStates"> <select
name="stateName" onchange="showStateInfo(this.value);">
<div id="StateInfoDisplay"></div>
i’m able to implement this. But new requiremetn came.. As per this i have to disappear state information and show states list once he selects some other state.
Next once user select Country as : USA
I have to display all the states of USA and disappear the delhi information.
How to do it?
I’m using only javascript…not jquery..
Laxman Chowdary
Pseudo-code for county click handler:
You can do pretty much anything you want in handler – why stop at 2 divs? Rewrite entire page or whatever. If you have some specific problem, post it with your code.