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';
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作