$(".area").change(function(ent,arg){ var $this = $(this), level = $(this).attr("id"); $.ajax({ url:'/Order/selectAddress', data:{l:level,type:'ajax',id:$this.val()|arg}, success:function(ret){ var data = eval("("+ret+")"), $subArea = $("#"+(parseInt(level)+1)); _html='<option value="" >请选择</option>'; for(var i in data){ _html += '<option value="'+data[i].region_id+'">'+data[i].region_name+'</option>'; } $subArea.empty().append(_html); $("#"+(parseInt(level)+2)).empty().append(_html); if( 2 == $subArea.children().length ){ var _id = $subArea.children().eq(1).val(); $subArea.children().eq(1).attr("selected","true"); $subArea.val(_id); $subArea.trigger("change",[_id]); } } }); });