Ignore:
Timestamp:
Apr 23, 2015 12:00:06 PM (10 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/assets/js/frontend/lecture.js

    r838 r906  
    55        $('#alert-services').modal('show');
    66    }
     7        $('#alert-services').on('hidden.bs.modal', function () {
     8                if (update_user_info == "1")
     9                {
     10                        $('#update_user_info').modal({backdrop: 'static',keyboard: false,});
     11                }
     12        });
    713}
    814
    915if (p_period == -1 && is_overdate == 1)
    1016{
     17       
    1118        $('#alert-trial-services').modal('show');
    1219        $('#alert-trial-services').on('hidden.bs.modal', function () {
     
    1724        });
    1825}
     26
    1927else
    2028{
    21         if (update_user_info == "1")
    22         {
    23                 $('#update_user_info').modal({backdrop: 'static'});
     29        if (licenseAvailable == "OK"){
     30                if (update_user_info == "1")
     31                {
     32                        $('#update_user_info').modal({backdrop: 'static'});
     33                }
    2434        }
    2535}
     
    194204
    195205});
    196 
    197 if ($("#form-field-province").val() !== 'undefined'){
    198         provinceId = $("#form-field-province").val();
    199         $.ajax({
    200         url: 'user/getDistrict/' + provinceId,
    201         type: 'POST',
    202         success: function (data, textStatus, jqXHR)
    203         {
    204             result = jQuery.parseJSON(data);
    205                         content = "";
    206                         if (result != null){
    207                                 for (var i in result){                 
    208                                         content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>'
     206$(document).ready(function(){
     207        if ($("#form-field-province").val() !== 'undefined'){
     208                provinceId = $("#form-field-province").val();
     209                $.ajax({
     210                        url: 'user/getDistrict/' + provinceId,
     211                        type: 'POST',
     212                        success: function (data, textStatus, jqXHR)
     213                        {
     214                                result = jQuery.parseJSON(data);
     215                                content = "<option></option>";
     216                                if (result != null){
     217                                        for (var i in result){                 
     218                                                content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>'
     219                                        }
     220                                       
    209221                                }
    210222                                $("#form-field-district").html(content);
    211223                        }
    212         }
    213     });
    214 }
    215 
    216 $("#form-field-province").change(function(){
    217         provinceId = this.value;
    218         $.ajax({
    219         url: 'user/getDistrict/' + provinceId,
    220         type: 'POST',
    221         success: function (data, textStatus, jqXHR)
    222         {
    223             result = jQuery.parseJSON(data);
    224                         content = "";
    225                         if (result != null){
    226                                 for (var i in result){                 
    227                                         content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>'
     224                });
     225        }
     226
     227        $("#form-field-province").change(function(){
     228                provinceId = this.value;
     229                $.ajax({
     230                        url: 'user/getDistrict/' + provinceId,
     231                        type: 'POST',
     232                        success: function (data, textStatus, jqXHR)
     233                        {
     234                                console.log(data);
     235                                result = jQuery.parseJSON(data);
     236                                content = "<option></option>";
     237                                if (result != null){
     238                                        for (var i in result){                 
     239                                                content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>'
     240                                        }
     241                                       
    228242                                }
    229243                                $("#form-field-district").html(content);
    230244                        }
    231         }
    232     });
    233 });
     245                });
     246        });
     247});
Note: See TracChangeset for help on using the changeset viewer.