Possible Duplicate:
Ways to circumvent the same-origin policy
Currently i'm trying to to call site.com/ajax/countPM
from jack.site.com
but the status of the request is canceled.
Possible Duplicate:
Ways to circumvent the same-origin policy
Currently i'm trying to to call site.com/ajax/countPM
from jack.site.com
but the status of the request is canceled.
Unfortunately despite you making a call on site.com to jack.site.com due to browser policies this falls into the gray shadows of 'Same Domain Policy', the browsers essentially treat both domains as different domains, and due to that restriction stop the requests. Actually Im not sure this is just a browser thing, may be even at a higher level. But bottom line is, its a security risk to allow javascript to be able to communicate across domains even sub domains as some hosting concepts are sub domains where each sub domain is independent of the other.
Its a security risk because its really easy to inject stuff into an unsuspecting site pretending to be the site.
Anyway one of the easier work arounds is through the use of some form of server-side scripting. In my case PHP, you would use cURL, or Soap to get the contents of the remote domains contents in this case I guess a JSON or XML object, and then push it up to your script from there.
(from jQuery's Additional Notes section on AJAX calls) Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol.
Now that said, you do have 2 options available to you to circumvent the cross-domain AJAX policy:
Please let me know if you need more clarification.
This might work for you (add to the jack.site.com):
document.domain = "site.com";
Not sure exactly on this, but it works for some things.