jQuery $(document).ready()在window.location.href之后没有触发 [英] jQuery $(document).ready() not firing after window.location.href

查看:187
本文介绍了jQuery $(document).ready()在window.location.href之后没有触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个页面,在事件发生后的第一页上我使用以下方法更改页面的位置:

I have two pages, on the first page after an event happens I change the location of the page by using:

window.location.href = "/pageb";

在第二页上,我有一个文档就绪事件,当来自页面时不会触发以上。当页面正常浏览时,就绪事件有效。

On the second page, I have a document ready event that doesn't fire when coming from the page above. The ready event works when the page is browsed to normally.

$(document).ready(function() {
     alert('ready');      
});

我正在使用google ajax cdn在我的网页上包含jquery。我很难过......

I am using the google ajax cdn to include jquery on my pages. I'm stumped...

推荐答案

虽然我使用的是jQuery(1.4.1),但它对我有用服务器,我使用:

It works for me, though I'm using jQuery (1.4.1) from my server, and I use :

window.location = "/index.html";

我不明白为什么它会改变任何东西,但也许你可以试试呢?

I don't see why it would change anything, but maybe you could try anyways ?

这篇关于jQuery $(document).ready()在window.location.href之后没有触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆