tobeyt23 Posted April 24, 2009 Share Posted April 24, 2009 I have a for loop that executes a ajax call each time thru. How do I after they have all completed then do something else like a redirect? Link to comment https://forums.phpfreaks.com/topic/155565-ajax-help/ Share on other sites More sharing options...
jackpf Posted April 24, 2009 Share Posted April 24, 2009 header('Location: page.php'); Or window.location = 'page.php'; Link to comment https://forums.phpfreaks.com/topic/155565-ajax-help/#findComment-818685 Share on other sites More sharing options...
ricmetal Posted April 26, 2009 Share Posted April 26, 2009 or refresh meta tag (google it) the header doesnt always work...........and the onload is javascript these are your options, pick 1 i pick number 3 but sir, yoo haven't read your options yet i dont care, im the president, i supposed to lead..not read.. Link to comment https://forums.phpfreaks.com/topic/155565-ajax-help/#findComment-819478 Share on other sites More sharing options...
jackpf Posted April 26, 2009 Share Posted April 26, 2009 header() is the proper way of doing it in my opinion. What do mean by "it doesn't always work"? I've never found a header() to "not work"... Link to comment https://forums.phpfreaks.com/topic/155565-ajax-help/#findComment-819485 Share on other sites More sharing options...
ricmetal Posted April 26, 2009 Share Posted April 26, 2009 for some reason it stopped redirecting my pages yesterday, when it did so for weeks. i searched the net and it says something like if you write any code (or text, im not sure) before the header redirect, it wont work. Link to comment https://forums.phpfreaks.com/topic/155565-ajax-help/#findComment-819490 Share on other sites More sharing options...
jackpf Posted April 26, 2009 Share Posted April 26, 2009 Yeah, if you send html to the page before you send your headers (without using output buffering) they won't send. If you have errors turned on, you'll get one. It's the same with cookies or sessions or any other headers. But that's logical - you can't send content before a header. Link to comment https://forums.phpfreaks.com/topic/155565-ajax-help/#findComment-819491 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.