Ajax and PHP cookies in Firefox

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top