- Timestamp:
- Apr 23, 2015 12:00:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php
r883 r906 26 26 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Tá»nh / Thà nh phá»</label> 27 27 <div class="col-sm-8"> 28 <select name="province" id="form-field-province" class="form-field-province col-xs-12 col-sm-10"> 28 <select name="province" id="form-field-province" class="form-field-province-user col-xs-12 col-sm-10"> 29 <option></option> 29 30 <?php foreach ($provinces as $key => $pro): ?> 30 31 <option value="<?php echo $key; ?>" <?php if ($user['province'] == $key) echo "selected"; ?>><?php echo $pro; ?></option> … … 38 39 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> 39 40 <div class="col-sm-8"> 40 <select name="district" id="form-field-district" class="form-field-district col-xs-12 col-sm-10">41 <select name="district" id="form-field-district" class="form-field-district-user col-xs-12 col-sm-10"> 41 42 42 43 </select> … … 60 61 var district_id = "<?php echo $user['district']; ?>"; 61 62 var province_id = "<?php echo $user['province']; ?>"; 63 62 64 $(document).ready(function(){ 63 $(".form-field-province ").change(function(){65 $(".form-field-province-user").change(function(){ 64 66 changeEventProvince(province_id); 65 67 }); 66 if ($(".form-field-province ").val() !== 'undefined'){68 if ($(".form-field-province-user").val() !== 'undefined'){ 67 69 checkSelectedDistrict(province_id); 68 70 } 69 71 }); 72 73 function changeEventProvince(provinceId){ 74 $(".form-field-district-user").html(""); 75 $.ajax({ 76 url: '/frontend/user/getDistrict/' + provinceId, 77 type: 'POST', 78 success: function (data, textStatus, jqXHR) 79 { 80 result = jQuery.parseJSON(data); 81 content = "<option></option>"; 82 if (result != null){ 83 for (var i in result){ 84 content = content + '<option value="' + result[i].district_id + '">'+ result[i].type + " " + result[i].district_name + '</option>' 85 } 86 } 87 $(".form-field-district-user").html(content); 88 } 89 }); 90 } 91 92 function checkSelectedDistrict(provinceId){ 93 $.ajax({ 94 url: '/frontend/user/getDistrict/' + provinceId, 95 type: 'POST', 96 success: function (data, textStatus, jqXHR) 97 { 98 result = jQuery.parseJSON(data); 99 content = "<option></option>"; 100 if (result != null){ 101 for (var i in result){ 102 if (result[i].district_id === district_id){ 103 content = content + '<option value="' + result[i].district_id + '" selected >' + result[i].type + " " + result[i].district_name + '</option>'; 104 }else{ 105 content = content + '<option value="' + result[i].district_id + '">' + result[i].type + " " + result[i].district_name + '</option>'; 106 } 107 } 108 109 } 110 $(".form-field-district-user").html(content); 111 } 112 }); 113 } 70 114 </script>
Note: See TracChangeset
for help on using the changeset viewer.