开发者

Ajax dynamic content from .aspx page

开发者 https://www.devze.com 2022-12-24 19:28 出处:网络
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\'v

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:

  1. Proxy the data through URLs on the same host as the page loading the script
  2. Use JSON-P as the data format
  3. 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消