weixin_33724046 2014-10-10 05:36 采纳率: 0%
浏览 27

延迟Ajax或JQuery

Alright I'm wondering how to delay before redirecting using Ajax because I've included exit splash page.

This is the code :

setTimeout(5000);
window.location = "https://www.google.com"

I've also tried this :

setTimeout(function(){ document.location = 'http://www.google.com';}, 2000); 

I've also tried :

delay : 3000

Splash Page javascript:

<!-- Start of ExitSplash.com Code -->
<script language="javascript">
var exitsplashmessage = '***************************************

 W A I T   B E F O R E   Y O U   G O !

  CLICK THE *CANCEL* BUTTON RIGHT NOW
     TO STAY ON THE CURRENT PAGE.

 I HAVE SOMETHING VERY SPECIAL FOR YOU!

***************************************';
var exitsplashpage = 'http://www.facebook.com';
</script>
<script language="javascript" src="http://www.google/bonus/exitsplash.php?tc=3399cc&uh=none&ad=none&sh=no&hv=no&bh=22&fs=12&lf=Arial&at=Powered%20by%20ExitSplash"></script>
<!-- End of ExitSplash.com Code -->
  • 写回答

2条回答 默认 最新

  • weixin_33709219 2014-10-10 05:39
    关注

    hope it will help you.

    setTimeout(functionName(),5000);
    
    function functionName()
    {
    document.location = 'http://www.google.com';
    }
    
    评论

报告相同问题?