I am using jQuery to animate some DOM elements, but I want the page to reload when the animations are complete, so I tried this:
function childDisablePopup()
{
$("#popup2",window.parent.document).animate({
width: "0px",
marginLeft: 0
}, "fast",
function()
{
$("#popup2",window.parent.document).animate({
height: "0px",
marginTop: 0
}, "fast",
function()
{
$("#backgroundPopup",window.parent.document).fadeOut("fast",
function()
{
$("#popup2",window.parent.document).remove();
window.location.reload(true);
});
});
});
}
However, when the animation completes, instead of the page reloading, I get this error:
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.reload]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: etc...]
What's going on? Can page reloads not be put in a function(){} closure?
Note: Browser: firefox 3.6.8.
Audience browsers: firefox 3+, chrome, safari 5+
Note: I also tried window.location.reload(true);
which returned the same error, and I tried window.location.href=window.location.href
which returned:
uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMLocation.href]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: etc...]