php - load an event on a finished redirected page after an AJAX call -
how load event after redirected page has finished loading, following ajax call?
for sake of simplicity, here sample code:
$.ajax({ type: "post", url: "some_page.php", success: function() { window.location.href="new_page.php"; // redirect page $(window).load(function() { alert("test"); }); // load after redirect } });
the "alert" box not load me, redirect works.
it's because success works after http request returned successfully. browser reloads new requested page in actions regarding original http request lost.
you may want like:
window.location.href = new_window.php?success=true
then test success on newly loaded page.
Comments
Post a Comment