HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux ns565604.ip-54-39-133.net 4.18.0-553.50.1.el8_10.x86_64 #1 SMP Tue Apr 15 08:09:22 EDT 2025 x86_64
User: greer489 (1034)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: /home/greer489/public_html/wp-content/themes/betheme/muffin-options/fields/ajax/field_ajax.js
(function($) {

  /* globals jQuery */

  "use strict";

  function mfnFieldAjax() {

    var $group = $('.mfn-ui .form-group.ajax');

    $group.on('click', '.mfn-btn', function(e) {

      e.preventDefault();

      var confirmed = $(this).attr('data-confirm');

      if ( confirmed || confirm( "Continue?" ) ) {

        var el = $(this),
          ajax = el.attr('data-ajax'),
          param = el.attr('data-param'),
          action = el.attr('data-action'),
          nonce = el.attr('data-nonce'),
          button_text = el.text();

        el.addClass('loading');

        var post = {
          'mfn-builder-nonce': nonce,
          action: action,
          post_type: param
        };

        $.post(ajax, post, function(data) {
          el.removeClass('loading');
          $('.btn-wrapper', el).text(data);

          setTimeout(function(){
            $('.btn-wrapper', el).text(button_text);
          },2000)

        });

      } else {
        return false;
      }

    });

  }

  /**
   * $(document).ready
   * Specify a function to execute when the DOM is fully loaded.
   */

  $(function() {
    mfnFieldAjax();
  });

})(jQuery);