public static function admin_page() { $action = 'options.php'; if (Falcon::is_network_mode()) { $action = 'settings.php?page=bbsub_options'; } ?> <div class="wrap"> <h2><?php _e('Falcon Options', 'falcon'); ?> </h2> <form method="post" action="<?php echo esc_attr($action); ?> "> <?php settings_fields('bbsub_options'); ?> <?php do_settings_sections('bbsub_options'); ?> <?php submit_button(); ?> </form> </div> <script type="text/javascript"> jQuery(document).ready(function ($) { var clearForm = function () { // Replace the title and form with the contents var $header = $('#bbsub-handlersettings-header'); var $table = $header.next(); if ( $table.is( '.form-table' ) ) { $table.remove(); } $header.remove(); var $error = $('#bbsub-handlersettings-error'); if ( $error.length ) { $error.remove(); } }; $('#bbsub_options_global_type').on('change', function (e) { $('#bbsub_options_global_type').after(' <img src="<?php echo esc_js(esc_url(admin_url('images/loading.gif'))); ?> " id="bbsub-loading" />' ); $.ajax({ url: ajaxurl, data: { action: 'bbsub_handler_section', handler: $(this).val() }, success: function (response) { clearForm(); $('#bbsub-handlersettings-insert').after(response); $('#bbsub-loading').remove(); }, error: function (response) { clearForm(); $('#bbsub-handlersettings-insert').after(response.responseText); $('#bbsub-loading').remove(); } }); }); }) </script> <?php }