G
GodSurfer
All,
I am trying to set a cookie on my page.
I have a div that contains a form where on the onclick of the button
calls a javascript function:
function login(){
loginAJAX(document.getElementById("userName").value,
document.getElementById("password").value);
}
/*Standard AJAX Code goes here*/
function loginAJAX(userName, password){
//alert(userName);
if (!isWorking && http)
{
var pageURL = ""; // The server-side script
pageURL = "functionLogin.php?userName=" + userName
+
"&password=" + password;
}
// alert(pageURL);
http.open("GET", pageURL, true);
http.onreadystatechange = handleHttpResponse;
isWorking = true;
http.send(null);
alert(http.responseText);
}
The functionLogin.php has the following code snippet:
setcookie("userName", $username,
time()+3600, "/",
".myDomain.com", 0);
setcookie("id", $row["userId"],
time()+3600, "/",
".myDomain.com",0);
This all works very well in IE 6.0 but Firefox doesn't set the
cookies...
Now when I just call functionLogin.php the cookies get set in both
browsers... I think it has something to do with the AJAX call but I'm
not sure... Any ideas?
BTW -- I'm going to also post this in an AJAX forum as well, but I'm
just not sure if it is my PHP or the AJAX.
Thanks for any and all help.
JV
I am trying to set a cookie on my page.
I have a div that contains a form where on the onclick of the button
calls a javascript function:
function login(){
loginAJAX(document.getElementById("userName").value,
document.getElementById("password").value);
}
/*Standard AJAX Code goes here*/
function loginAJAX(userName, password){
//alert(userName);
if (!isWorking && http)
{
var pageURL = ""; // The server-side script
pageURL = "functionLogin.php?userName=" + userName
+
"&password=" + password;
}
// alert(pageURL);
http.open("GET", pageURL, true);
http.onreadystatechange = handleHttpResponse;
isWorking = true;
http.send(null);
alert(http.responseText);
}
The functionLogin.php has the following code snippet:
setcookie("userName", $username,
time()+3600, "/",
".myDomain.com", 0);
setcookie("id", $row["userId"],
time()+3600, "/",
".myDomain.com",0);
This all works very well in IE 6.0 but Firefox doesn't set the
cookies...
Now when I just call functionLogin.php the cookies get set in both
browsers... I think it has something to do with the AJAX call but I'm
not sure... Any ideas?
BTW -- I'm going to also post this in an AJAX forum as well, but I'm
just not sure if it is my PHP or the AJAX.
Thanks for any and all help.
JV