Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery $(document).ready() not firing after window.location.href

Tags:

jquery

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');      
});

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

like image 414
jimj Avatar asked Nov 15 '22 12:11

jimj


1 Answers

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 ?

like image 197
David V. Avatar answered Dec 09 '22 20:12

David V.