Reputation: 23297
I've done a little browsing on this site regarding this topic. And found out that its possible to set php cookies via ajax. But I don't know why I can't set cookies on an ajax called php script. I even set a default value, just to make sure that the cookie is getting something:
setcookie("tradename", 'mono', time()+3600);
setcookie("bus_id", 'loque', time()+3600);
The ajax called php script has mysql queries on it. And they're inserting records into the database. The setting of cookies happens before the queries.
But I don't know why I'm not getting anything when I use print_r from another page:
print_r($_COOKIE);
I'm using jquery's ajax() function. What do I do to detect what's wrong, please help. Thanks.
Upvotes: 1
Views: 1242