如何使用 jQuery 实现页面重定向?

jqueryweb developmentfront end technology

要在 jQuery 中重定向到另一个网页,请使用 attr() 函数。您可以尝试运行以下代码来重定向到另一个网页。

示例

<html>
   <head>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
      </script>
      <script>
         $(document).ready(function() {
            $(location).attr('href','http://qries.com');
         });
      </script>
   </head>
   <body>
   </body>
</html>

相关文章