|
@@ -9,12 +9,18 @@ |
|
@@ -9,12 +9,18 @@ |
9
|
<form class="js-ajax-form" method="post" action="{:url('School/school_edit_post')}" role="form" style="margin-top: 20px;">
|
9
|
<form class="js-ajax-form" method="post" action="{:url('School/school_edit_post')}" role="form" style="margin-top: 20px;">
|
10
|
<div class="input-group">
|
10
|
<div class="input-group">
|
11
|
<span class="input-group-addon">学校地区:</span>
|
11
|
<span class="input-group-addon">学校地区:</span>
|
12
|
- <select class="form-control">
|
12
|
+ <select class="form-control" name="province" id="province" required>
|
|
|
13
|
+ <option>请选择</option>
|
13
|
<foreach name="$province" item="p">
|
14
|
<foreach name="$province" item="p">
|
14
|
<option value="{$p.name}">{$p.name}</option>
|
15
|
<option value="{$p.name}">{$p.name}</option>
|
15
|
</foreach>
|
16
|
</foreach>
|
16
|
</select>
|
17
|
</select>
|
17
|
- <input type="text" class="form-control" name="region" value="{$data.region}" >
|
18
|
+ <select class="form-control" name="city" id="city" required>
|
|
|
19
|
+ <option>请选择</option>
|
|
|
20
|
+ </select>
|
|
|
21
|
+ <select class="form-control" name="county" id="county" required>
|
|
|
22
|
+ <option>请选择</option>
|
|
|
23
|
+ </select>
|
18
|
<input type="text" class="form-control" name="region" value="{$data.region}" >
|
24
|
<input type="text" class="form-control" name="region" value="{$data.region}" >
|
19
|
</div>
|
25
|
</div>
|
20
|
<br>
|
26
|
<br>
|
|
@@ -40,4 +46,50 @@ |
|
@@ -40,4 +46,50 @@ |
40
|
</div>
|
46
|
</div>
|
41
|
</body>
|
47
|
</body>
|
42
|
<script src="__STATIC__/js/admin.js"></script>
|
48
|
<script src="__STATIC__/js/admin.js"></script>
|
|
|
49
|
+<script>
|
|
|
50
|
+ $('#province').change(function(){
|
|
|
51
|
+ var province_id = $('#province option:selected').val();
|
|
|
52
|
+ $.ajax({
|
|
|
53
|
+ url:"{:url('getArea')}",
|
|
|
54
|
+ type:"GET",
|
|
|
55
|
+ data:{'pid':province_id},
|
|
|
56
|
+ success:function(data) {
|
|
|
57
|
+ var result = eval("(" + data + ")");
|
|
|
58
|
+ if(result.code==20000){
|
|
|
59
|
+ var mydata = "<option value=''>请选择</option>";
|
|
|
60
|
+ for (var i = 0; i < result.data.length; i++) {
|
|
|
61
|
+ var data = result.data[i];
|
|
|
62
|
+ mydata += '<option value="'+data.name+'">'+data.name+'</option>';
|
|
|
63
|
+ }
|
|
|
64
|
+ $('#city').html(mydata);
|
|
|
65
|
+ $('#county').html("<option value=''>请选择</option>");
|
|
|
66
|
+ }else if(result.code==40005){
|
|
|
67
|
+ alert('获取失败!');
|
|
|
68
|
+ }
|
|
|
69
|
+ }
|
|
|
70
|
+ })
|
|
|
71
|
+ })
|
|
|
72
|
+ //获取区/县
|
|
|
73
|
+ $('#city').change(function(){
|
|
|
74
|
+ var city_id = $('#city option:selected').val();
|
|
|
75
|
+ $.ajax({
|
|
|
76
|
+ url:"{:url('getArea')}",
|
|
|
77
|
+ type:"GET",
|
|
|
78
|
+ data:{'pid':city_id},
|
|
|
79
|
+ success:function(data) {
|
|
|
80
|
+ var result = eval("(" + data + ")");
|
|
|
81
|
+ if(result.code==20000){
|
|
|
82
|
+ var mydata = "<option value=''>请选择</option>";
|
|
|
83
|
+ for (var i = 0; i < result.data.length; i++) {
|
|
|
84
|
+ var data = result.data[i];
|
|
|
85
|
+ mydata += '<option value="'+data.name+'">'+data.name+'</option>';
|
|
|
86
|
+ }
|
|
|
87
|
+ $('#county').html(mydata);
|
|
|
88
|
+ }else if(result.code==40005){
|
|
|
89
|
+ alert('获取失败!');
|
|
|
90
|
+ }
|
|
|
91
|
+ }
|
|
|
92
|
+ })
|
|
|
93
|
+ })
|
|
|
94
|
+</script>
|
43
|
</html> |
95
|
</html> |