<?php

FLBuilderModel::default_settings($settings, array(
	'post_type' 		=> 'post',
	'post_taxonomies'	=> 'none',
));
?>

<script type="text/javascript">
	;(function($) {
		$('body').on('change', '.fl-builder-settings select[name="post_type[]"]', function() {
			var post_type = $(this).val();
			var post_taxonomies = $('.fl-builder-settings select[name="post_taxonomies"]');
			var selected_taxonomy = <?php echo json_encode( $settings->post_taxonomies ); ?>;
			$.ajax({
				type: 'post',
				data: {
					action: 'pp_get_taxonomies',
					post_type: post_type,
					value: selected_taxonomy
				},
				url: ajaxurl,
				success: function(res) {
					if ( res !== 'undefined' || res !== '' ) {
						post_taxonomies.html(res);
						post_taxonomies.find('option[value="'+selected_taxonomy+'"]').attr('selected', 'selected');
					}
				}
			});
		});
	})(jQuery);
</script>
