php - Cookies not visible after ajax/load request
I have the following problem:
On one page I display some articles using php and grabbing them from the database. The articles have two display types: daily and hourly. The display type is stored in a cookie.
The problem is that whenever i load additional articles using infinite scroll and ajax the cookies are not taken. If i echo them I receive an empty string. Also when changing from the hourly view to the daily view the same problem occours.
For adding additional post i use jquery post and for loading the diferent display view i use jquery.load()
I know that there was a cross origin policy but i fixed it by adding in htaccess
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
EDIT: I installed the website also on another server where it works ok. I noticed that on the good server tha ajax request is sending also the "settings" cookie. On the bad server only the "PHPSESSID" cookie is beeing sent.
Answer
Solution:
ok it seems the problem was the www the request was made from www.mydomain.com to mydomain.com i fixed it by adding the full path in the url
or