How do you get content from another domain with .load()?

后端 未结 4 1783
无人及你
无人及你 2020-12-08 12:46

Requesting data from any location on my domain with .load() (or any jQuery ajax functions) works just fine.

Trying to access a URL in a different domain doesn\'t wor

4条回答
  •  执笔经年
    2020-12-08 13:08

    I know of another solution which works. It does not require that you alter JQuery. It does require that you can stand up an ASP page in your domain. I have used this method myself.

    1) Create a proxy.asp page like the one on this page http://www.itbsllc.com/zip/proxyscripts.html

    2) You can then do a JQuery load function and feed it proxy.asp?url=....... there is an example on that link of how exactly to format it. Anyway, you feed the foreign page URL and your desired mime type as get variables to your local proxy.asp page. The two mime types I have used are text/html and image/jpg.

    Note, if your target page has images with relative source links those probably won't load. I hope this helps.

提交回复
热议问题