I'm using this Ajax script (http://www.dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-content) to load content from an aspx page on another server than the page calling the content. So far I've learned that this is a no go. The problem seems to be that when using an absolute link to content the script fails as apposed to using a relative link.
I've searched the web for about 10 hours now, and I sti开发者_StackOverflow中文版ll haven't found what I'm looking for. I'm in need of some expert help here. Appreciate any help.
Best regards Nano
It doesn't matter if the URL is absolute or relative, all that matters is that the server is different. See the Same Origin Policy.
The workarounds are:
- Proxy the data through URLs on the same host as the page loading the script
- Use JSON-P as the data format
- Use something which has options for cross domain requests (e.g. Flash)
You can't load content from another domain this way (browsers don't allow it for security reasons). You have options though. If you really need to do cross-domain AJAX (that's what its called) you might want to look into using jQuery and JSON-P for your AJAX. There's also several options with flash, iframes and proxies (none of them are simple).
精彩评论