How can I execute jQuery/JS code as soon as a jQuery/JS redirect like...
$(location).attr(\'href\',\'/target_path\');
...or...
var x = "It's some text";
var loc = '/target_path';
loc += '?message=' + encodeURI(x);
The JS file on the new page can then look at the query string to see if a message is there, and do the required action if it's detected.
You can use window.location.search
on the new page to see what's there, although I'd recommend hunting for a deparam function in a library to turn the query string into a more usable object.