qs.defineNS('app'); app.BenchmarkPlans_Admin = qs.createObject(); app.BenchmarkPlans_Admin.prototype = { options:{ id: null }, initialize: function (options) { this.options = options; var self = this; var yearSelect = $("select#year"); var year = yearSelect.val(); this.doSortList('availableList'); this.doSortList('selectedList'); yearSelect.change(function () { year = yearSelect.val(); if (year) { self.updateCountiesAjax(year, self.options.id); } else { $('.availableList').empty(); } }); }, updateCountiesAjax: function (year, id) { var self = this; var request = { action: 'getCounties', year: year, id: id }; qs.ajax(qs.constant('BASE_URL') + '/' + qs.constant('CURRENT_PAGE'), request).done(function (data) { if (typeof data === 'object') { var avaliable = $('.availableList').empty(); $('.selectedList').empty(); $('.selectedCount').html('0'); $.each(data, function (key, value) { avaliable.append('