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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -