populateDistrictsDropdown( e ) {
    let cityID = $( e.currentTarget ).val();
    let $wrapper = $( e.currentTarget ).closest( '.woocommerce-billing-fields, .woocommerce-shipping-fields' );
    let provCode = $wrapper.find( '#billing_state, #shipping_state' ).val();

    // add 'Loading' message to district field
    let $districtsSelect = $wrapper.find( '#_billing_district_field select, #_shipping_district_field select' );
    $districtsSelect.html( '<option>Loading...</option>' );

    wcisAPI.get( wcisLocalize.WCIS_API + '/districts/' + provCode + '/' + cityID )
      .then( result => {
        let options = '';
        for( let id in result ) {
          options += `<option value="${id}">${result[id]}</option>`;
        }

        $districtsSelect.html( options );
      });
  }
/**
   * Populate the District dropdown according to selected City
   * 
   * TODO: Change to pure JS
   */
Populate the District dropdown according to selected City

Change to pure JS
Populate the District dropdown according to selected City Change to pure JS
populateDistrictsDropdown( e ) {
    let cityID = $( e.currentTarget ).val();
    let $wrapper = $( e.currentTarget ).closest( '.woocommerce-billing-fields, .woocommerce-shipping-fields' );
    let provCode = $wrapper.find( '#billing_state, #shipping_state' ).val();
    let $districtsSelect = $wrapper.find( '#_billing_district_field select, #_shipping_district_field select' );
    $districtsSelect.html( '<option>Loading...</option>' );
    wcisAPI.get( wcisLocalize.WCIS_API + '/districts/' + provCode + '/' + cityID )
      .then( result => {
        let options = '';
        for( let id in result ) {
          options += `<option value="${id}">${result[id]}</option>`;
        }
        $districtsSelect.html( options );
      });
  }
populateDistrictsDropdown ( e ) { let cityID = $ ( e . currentTarget ) . val ( ) ; let $wrapper = $ ( e . currentTarget ) . closest ( '.woocommerce-billing-fields, .woocommerce-shipping-fields' ) ; let provCode = $wrapper . find ( '#billing_state, #shipping_state' ) . val ( ) ; let $districtsSelect = $wrapper . find ( '#_billing_district_field select, #_shipping_district_field select' ) ; $districtsSelect . html ( '<option>Loading...</option>' ) ; wcisAPI . get ( wcisLocalize . WCIS_API + '/districts/' + provCode + '/' + cityID ) . then ( result => { let options = '' ; for ( let id in result ) { options += ` ${ id } ${ result [ id ] } ` ; } $districtsSelect . html ( options ) ; } ) ; }
Populate the District dropdown according to selected City
Populate the District dropdown according to selected City
// add 'Loading' message to district field