title: On the popup form - Why Form submission is loading the page
body: <p>On this page <a href="https://spa.micra-anglia.gr/" rel="nofollow noreferrer">https://spa.micra-anglia.gr/</a> if you go to &quot;Purifying Detox face &amp; body ritual&quot; section and click on this title you can see that a sidebar is showing. On this sidebar, I am calling ajax to get some content.</p>
  <p>On this content, I have a WordPress form that is showing using shortcode.</p>
  <p>Now, If I press the Submit button (Blue one) it's reloading the page. Why?</p>
  <p>but if you check the same form on this page: <a href="https://spa.micra-anglia.gr/test-form/" rel="nofollow noreferrer">https://spa.micra-anglia.gr/test-form/</a> you can see the page is not loading.</p>
  <p>Can you tell me what is happening here?</p>
  <p><strong>My JS code for the pulling content:</strong></p>
  <pre><code>jQuery(document).ready(function($){
      $(document).on('click','.custom-ajax-link,.open_sidebar_post, .post-title a,.post .post-item .post-thumbnail a',function(e){
          loadPostEvent(e);
          return false;
      });
  
      function loadPostEvent(event){
          var el = $(event.currentTarget);
          var url = el.attr('href');
          if(typeof url == &quot;undefined&quot; || url  === ''){
              url = el.attr('data-href');
              if(typeof url == &quot;undefined&quot; || url  === '') {
                  var classList = el.attr('class').split(/\s+/);
                  $.each(classList, function (idx, item) {
                      if(item.indexOf('MAINURL') &gt;=0){
                          url = item.replace('MAINURL',main_url).trim();
                      }
                  })
              }
  
          }
          $('.sidebar-post').empty();
          $('.sidebar-post').append('&lt;span class=&quot;close-sidebar-post&quot;&gt;&lt;/span&gt;&lt;span class=&quot;loading-circle&quot;&gt;&lt;i class=&quot;fas fa-circle-notch fa-spin&quot;&gt;&lt;/i&gt;&lt;/span&gt;');
          if(!$('body').hasClass('open-right-sidebar')){
              var scrollbarWidth = getScrollbarWidth();
              if(scrollbarWidth &gt; 0){
                  $('body').css('padding-right',scrollbarWidth+'px');
              }
              $('body').addClass('open-right-sidebar');
          }
          $.ajax({
              url: '&lt;?php echo admin_url('admin-ajax.php')?&gt;',
              data: {action: 'load_sidebar_post', url: url},
              type: 'POST',
              success: function(res){
                  if(res !== ''){
                      if(!$('#vc_accordion_script-js').length){
                          $('&lt;script&gt;')
                              .attr('id', 'vc_accordion_script-js')
                              .attr('src', '&lt;?php echo get_site_url()?&gt;/wp-content/plugins/js_composer/assets/lib/vc_accordion/vc-accordion.min.js?ver=6.7.0')
                              .appendTo('head');
                      }
                      $('.sidebar-post').empty();
                      $('.sidebar-post').append('&lt;div class=&quot;sidebar-content portfolio-template-default single single-portfolio&quot;&gt;&lt;span class=&quot;close-sidebar-post&quot;&gt;&lt;/span&gt;'+res+'&lt;/div&gt;');
                      window.vc_js();
                      console.log(Kalium);
                      galleryContentPost();
                      Kalium.Media.VideoJS.initVideoElements();
                  }
              }
          })
      }
  });
  </code></pre>