(function($) { /** * Add Utility functionality */ $(function() { $('.aptu-submit-file').on('click', function() { $import_true = confirm('Are you sure to import dummy content ? This button should only be pressed on a clean WordPress installation. This will overwrite all existing option values, please proceed with caution!'); if ($import_true === false) return; var theme_slug = $('.aptu-theme-name').val(); var option_name = $(".aptu-theme-name option:selected").data('option-name'); $.ajax({ type: 'post', url: aptu_backend_js_params.ajax_url, data: { _wpnonce: aptu_backend_js_params.ajax_nonce, action: 'aptu_my_action', theme_slug: theme_slug, option_name: option_name }, beforeSend: function() { $('.aptu-msg').hide(); $('.aptu-block-message').show(); }, success: function(res) { $('.aptu-block-message').hide(); $('.aptu-msg').hide(); $('.aptu-msg').html(res).show(); } }); }); }); }(jQuery));