title: struts2: update second select based on first select value using javascript and jquery
body: <p>I am working on a struts2 project where I have 3 html select controls each one being dependent on the previous selection. Say the first select is for country, second for state, third for city. The list of options in the state select would be filtered to only display the states in that country and so on. Due to some other limitations I am using the basic html select control instead of struts2's. Here is a sample of how I am currently populating the select:</p>
  
  <pre><code>&lt;select id="stateSelect"  name="selectedState"&gt;
  &lt;s:iterator value="#session['myModel'].states" status="itr"&gt;
       &lt;option value="&lt;s:property value="code"/&gt;"&gt;
        &lt;s:property value="label"/&gt;
  &lt;/option&gt;
  &lt;/s:iterator&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I think that what I need to do is onchange event do an ajax call to retrieve the list of "states" based on the selected "country". The questions are:<br>
  1. how can I do this ajax call using jquery?<br>
  2. what do I need to pass as the url for the ajax call? just the action name?<br>
  3. how can I parse the results back? From java code I can return a list of "State" objects that have "code" and "label" and other properties. How can I parse this list in javascript and generate the proper options for the select tag?</p>