HEX
Server: Apache
System: Linux web5.visualcom.es 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: ensaco.es (10019)
PHP: 8.3.32
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/ensaco.es/httpdocs/wp-content/plugins/bb-theme-builder/modules/loop/js/settings.js
( function( $ ) {

	FLBuilder.registerModuleHelper( 'loop', {

		init: function() {
			this.form = $('.fl-builder-settings');
			this.showTerms = this.form.find('select[name=terms_taxonomy]');
			this.showTerms.on('change', this._toggleChildTerms.bind( this ) );
		},

		_toggleChildTerms: function() {

			var taxonomy = this.form.find('select[name=terms_taxonomy]').val(),
				termSelect = this.form.find('select[name=term_parent]');

			FLBuilder.ajax( {
				action           : 'fl_loop_get_terms',
				taxonomy         : taxonomy,
			}, function( response ) {

				try {
					let data = (typeof response === 'string') ? JSON.parse(response) : response;
					termSelect.empty();
					$.each( data, function ( key, value ) {
						termSelect.append($('<option>', {
							value: key,
							text: value
						}));
					});
				} catch( e ) {}
			} );
		},
	} );

} )( jQuery );