문제

I have a domain foo.com on server bar. I have a subdomain api.foo.com which has a CNAME entry pointing to ghs.google.com (as the subdomain is being used by Google Apps).

I am trying to make jQuery.get() calls from search.foo.com to api.foo.com. The calls all seem to go through properly, and the callback function is executed each time, but the data returned is always an empty string, which makes me think some kind of browser security policy is afoot.

Firstly - is a call from a.foo.com to b.foo.com permissible?

if(!permissible) { //Secondly - how can I make this work? }

Thanks,

Finbarr

도움이 되었습니까?

해결책

Finbarr has the right idea. You cannot do cross site XHR, and a.foo.com to b.foo.com is considered cross site.

With that said you have a few options. You can do something like this - http://jquery-howto.blogspot.com/2009/04/cross-domain-ajax-querying-with-jquery.html

We use django/python in house but I've done something similar where the request is made by the server and there is a simple view configured to accept the AJAX request and return the data that was requested server side. Hope that helps!

Edit: Just noticed that Finbarr was the submitter and the commenter - sorry!

다른 팁

For this scenario, you can use: http://code.google.com/p/iframe-xdr solution.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top