PHP Classes
elePHPant
Icontem

File: webroot/js/regions.js

Recommend this page to a friend!
  Classes of Andraž  >  pingvincek  >  webroot/js/regions.js  >  Download  
File: webroot/js/regions.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: pingvincek
Manage a site for organizing dates between people
Author: By
Last change:
Date: 2 years ago
Size: 1,396 bytes
 

 

Contents

Class file image Download
$(document).ready(function(){
    $('#UserObcina').live('change', function() {
        if($(this).val().length != 0) {
            $.getJSON('/users/get_regions_ajax',
            { 
                countryId: $(this).val()
            },
            function(regionsTMP) {
                if(regionsTMP !== null) {
                    populateRegionsList(regionsTMP);
                } 
            }); 
        }
    });
});

function populateRegionsList(regionsTMP) { 
    var options = '<option value=""></option>';
    $.each(regionsTMP, function(index, carModel) {
        options += '<option value="' + index + '">' + carModel + '</option>';
    });
    $('#UserCityId').html(options);
}




$(document).ready(function(){
    $('#UserCountryId').live('change', function() {
        if($(this).val().length != 0) {
            $.getJSON('/users/getajaxregions',
            {
                regionId: $(this).val()
            },
            function(regionsSTMP) {
                if(regionsSTMP !== null) {
                    populateRegionsSList(regionsSTMP);
                }
            });
        }
    });
});

function populateRegionsSList(regionsSTMP) {
    var options = '<option value=""></option>';
    $.each(regionsSTMP, function(index, carModel) {
        options += '<option value="' + index + '">' + carModel + '</option>';
    });
    $('#UserObcina').html(options);
}