Re: [PHP] php/ajax question
- From: ceo@xxxxxxxxx ("Richard Lynch")
- Date: Tue, 2 Jan 2007 19:38:46 -0600 (CST)
Mixing Location and Cookie headers has always been hit and miss...
I think you could fix it with session_write_close() or you could just
replace the Location: with:
require 'b.php';
since you are just wasting HTTP connections the way you have it now...
On Sat, December 30, 2006 12:56 pm, tedd wrote:
Hi gang:
I have a small php script that behaves differently depending upon
who's calling it. The code is:
<?php session_start(); /* a.php */
ob_start();
$_SESSION['var'] = "test";
ob_clean();
header("Location: http://www.example.com/b.php"); /* Redirect browser
*/
exit; ?>
If the code is called directly, namely http://www.example.com/a.php,
then the $_SESSION var is filled with "text" and the redirect is
realized.
However, if the php script is called via ajax:
-snip- preceding ajax
function sndReq(action)
{
http.open('get', 'a.php');
http.send(null);
}
Then the $_SESSION var is filled with "test", but the redirect is not
realized.
Why can't the php script redirect the browser when called via ajax ?
Thanks.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.
- Prev by Date: Re: [PHP] php 5 and register_globals=off gives lotsa errors
- Next by Date: Re: [PHP] Trouble compiling in mysqli under PHP5 -- "mysql_config not found"
- Previous by thread: Re: [PHP] php 5 and register_globals=off gives lotsa errors
- Next by thread: Re: [PHP] Pushing a file to the browser
- Index(es):
Relevant Pages
|
|