Redirect Using jQuery

This question already has an answer here:

  • How do I redirect to another webpage? 67 answers

  • You can use the window.location to redirect a browser:

    https://developer.mozilla.org/en/DOM/window.location


    你可以使用JavaScript的本地 window.location

    $('#link').click(function(){  
    
        if(validation_fails) {
            window.location="http://this.site.com/";
        }
        else {
            return true;
        }
    }
    

    You can hash the div id to the window.location to display the div. Something like:

    $(#link).click(function(){  
      if(validation_fails) window.location += "#<YOUR_DIV_ID>" ;  
      else return true;
    }
    
    链接地址: http://www.djcxy.com/p/1946.html

    上一篇: 重定向到其他页面上警告框确认

    下一篇: 使用jQuery重定向