1/* 2** nopCommerce country select js functions 3*/ 4+function ($) { 5 'use strict'; 6 if ('undefined' == typeof (jQuery)) { 7 throw new Error('jQuery JS required'); 8 } 9 function countrySelectHandler() { 10 var $this = $(this); 11 var selectedItem = $this.val(); 12 var stateProvince = $($this.data('stateprovince')); 13 var loading = $($this.data('loading')); 14 loading.show(); 15 $.ajax({ 16 cache: false, 17 type: "GET", 18 url: $this.data('url'), 19 data: { 20 'countryId': selectedItem, 21 'addSelectStateItem': "true" 22 }, 23 success: function (data, textStatus, jqXHR) { 24 stateProvince.html(''); 25 $.each(data, 26 function (id, option) { 27 stateProvince.append($('<option></option>').val(option.id).html(option.name)); 28 }); 29 }, 30 error: function (jqXHR, textStatus, errorThrown) { 31 alert('Failed to retrieve states.'); 32 }, 33 complete: function (jqXHR, textStatus) { 34 loading.hide(); 35 } 36 }); 37 } 38 if ($(document).has('[data-trigger="country-select"]')) { 39 $('select[data-trigger="country-select"]').change(countrySelectHandler); 40 } 41 $.fn.countrySelect = function () { 42 this.each(function () { 43 $(this).change(countrySelectHandler); 44 }); 45 } 46}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.