jquery not proceeding to next page

后端 未结 5 999
醉话见心
醉话见心 2020-12-12 05:29

i have jquery, but it is not going to next page, it always display images and waits, never proceed to next page.

HTML code:

相关标签:
5条回答
  • 2020-12-12 06:03

    Others have mentioned the problem with your selector.

    However, this code also appears naked between two script tags. This means that they will be executed as soon as they are parsed. This means that they could be executed before the whole DOM is loaded, rendering them ineffective.

    You need to use something like this:

    <SCRIPT type="text/javascript">  
       var $ = jQuery.noConflict();  
       $(document).ready(function(){
           $('#toHide').show().doTimeout(100,function() { 
               $('#safeForma3').submit();
           });
       });
    </SCRIPT>
    
    0 讨论(0)
  • 2020-12-12 06:06

    There is no id named 'safeForm15' in your HTML, which is what your setTimeout is trying to select. In fact, the form has ID namespaced, which I believe is illegal to begin with.

    Regardless, the quick fix is to cue off of 'toHide', and get rid of the component.getMarkupId bit.

    $('#toHide').find('form').submit();
    

    Added:

    You need to change this:

      buffer.append("  setTimeout(function(){ $(\"#").append(component.getMarkupId()).append("\").submit()}, 100);\n"); 
    

    to this:

      buffer.append("  setTimeout(function(){$('#toHide').find('form').submit();}, 100);\n"); 
    
    0 讨论(0)
  • 2020-12-12 06:12

    I think you should try this:

    $('#toHide').find('form').submit();
    

    Or if the form has an ID on it (I'm not familiar with Wicket) you can just use:

    $('#safeForm').submit();
    

    The ID selector uses a '#' charactor, not a '.', which is the class selector prefix.

    0 讨论(0)
  • 2020-12-12 06:18

    This is a problem with IE, if you have a GIF that is not visible and then set it to visible the animation doesn't work.

    Best thing to do is just used an empty image tag like this <img src='' /> and then when you want it to become visible set the src to the correct path i.e. <img src='AnimatingImg.gif' />.

    It should work if you do it this way.

    EDIT

    You can do it like this:

    <SCRIPT type="text/javascript">  
       var $ = jQuery.noConflict();       
       $('#toHide').show();
       $('#loadingImg').attr('src', 'img/load.gif');
       setTimeout(function() {
           $('#toHide').find('safeForma3').submit();
       }, 100);
    </SCRIPT>
    

    html code:

    <div id="toHide" class="pb-text-align-center">
        <img id="loadingImg" style="display:inline" src="" />
        <form wicket:id="safeForm" class="clearfix">
            <input type="hidden" wicket:id="submitted" value="false" />
        </form>
    </div>
    

    Try that, might want a bit of fiddling though.

    0 讨论(0)
  • 2020-12-12 06:19

    The "toHide" <div> has that string as it's id value, not it's class, so you need:

     $('#toHide')
    

    The selector ".toHide" looks for an element with "toHide" as part of the class, so that wouldn't find your <div> at all.

    To find the form, you'd use

     $('#toHide form').submit();
    
    0 讨论(0)
提交回复
热议问题