jquery not proceeding to next page

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

HTML code:

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

HTML view source:

<SCRIPT type="text/javascript">  
   var $ = jQuery.noConflict();  
   $('.toHide').show().doTimeout(100,function() { 
   $('.toHide').find('safeForma3').submit();});
</SCRIPT>

wicket code:

static private class SafeSubmitBehaviour extends AbstractBehavior{
      public void onRendered( Component component ) {
          super.onRendered( component );      
          StringBuffer buffer = new StringBuffer(200);
          buffer.append("<script type="text/javascript" >n");
          buffer.append("var $ = jQuery.noConflict();n "); 
          buffer.append(" $('.toHide').show().doTimeout(100,function() {  $('.toHide').find('");
          buffer.append(component.getMarkupId()).append("').submit();});n</script>");
          component.getResponse().write(buffer);
        }  
  } 
      buffer.append(component.getMarkupId()).append("').submit();});n</script>");

i have tried with: $('.toHide').find('form').submit();});. But still no use.

After chaging $('.toHide') to $('#toHide'), page is going ot next page, but animation is not happening in IE6/7, it works fine in FF.


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.


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();

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"); 
链接地址: http://www.djcxy.com/p/59030.html

上一篇: 没有办法修改它的源代码

下一篇: jquery没有进入下一页