Ignore:
Timestamp:
Mar 27, 2015 9:49:55 AM (10 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

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

    r765 r838  
    193193        });
    194194
    195 })
     195});
     196
     197if ($("#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>'
     209                                }
     210                                $("#form-field-district").html(content);
     211                        }
     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>'
     228                                }
     229                                $("#form-field-district").html(content);
     230                        }
     231        }
     232    });
     233});
Note: See TracChangeset for help on using the changeset viewer.