1 //第一个是省份,第二个是具体城市。
 2 //选中省份,第二个下拉框的选项实现改变。
 3 
 4 $(document).ready(function(){
 5     $("#big").change(function(){    //更改省份下拉框的选项时候触发
 6         $("#detail").empty();
 7         $.ajax({
 8             type:"post",
 9             url:"changeCitiesAction.do",//传入action来处理
10             data:"pid="+$("#big option:selected").val(),//传递的参数(父id-即省份id)
11             success:function(xml){
12                 $(xml).find("bigList").find("type").each(function(){//解析jsp动态生成的xml 
13                     var name = $(this).find("cityName").text();
14                     var id = $(this).find("id").text();
15                     //把解析出来的书库写入页面 <!--EndFragment-->
16                     $("#detail").append("<option value="+id+">"+name+"</option>");
17                 })
18             }
19         });
20     });
21 });