Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.3 kB
2
Indexable
Never
$('.btnRegIsyef').on('click', function(evt) {
        evt.preventDefault();
        if ($('.loading-reg').length < 1) {
          $('body').append('<div class="loading-reg hidden"><div class="loading centerFix"><div class="spinner"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div></div></div>');
        }
        if (!$(this).hasClass('disableBtn')) {
          var isValid = $(".formAct").validationEngine('validate');
          if (isValid) {
            $('.loading-reg').removeClass('hidden').fadeIn().addClass('active');
            var form = $('.formAct');
            var fd = new FormData();
            var proposal_bisnis = $('.formAct .proposal_bisnis').get(0).files[0];
            fd.append("proposal_bisnis", proposal_bisnis);

            $.ajax({
              type: "POST",
              url: "https://isef.co.id/account/api_reg/isyefreg",
              data: fd,
              contentType: false,
              cache: false,
              processData: false,
              success: function(data) {
                var respon = JSON.parse(data);
                $('.loading-reg').fadeOut().addClass('hidden').removeClass('active');
                $('#modalMessage .evtContent').html(respon.message);
                $('#modalMessage .title').html(respon.title);

                if(respon.status == 'success') {
                  $('#modalMessage').addClass('success');
                } else {
                  $('#modalMessage').addClass('error');
                }
                $.fancybox.open({
                  src: '.modalMessage',
                  type: 'inline',
                  closeClickOutside: true,
                  clickSlide: false,
                  clickContent: true,
                  smallBtn: true,
                  touch: false,
                  opts : {
                    afterShow : function( instance, current ) {
                      console.info( 'done!' );
                    }
                  }
                });
              },
              error: function(error) {
                // console.log("errrorr");
                console.log(error);
              }
            });
          }

        }
      });