This behavior also depends on the cookie settings and the browser.
In most cases, cookies are valid on a domain and all subdomains.
If the domain name in your cookie’s domain parameter doesn’t start with a period, then it will not let subdomains read that cookie. If it does start with the period, then all subdomains will have full access to that cookie’s value.
Generally it’s better to operate only in one domain when working with cookies (and ajax).