How do I send a cross-domain POST request via JavaScript?

后端 未结 17 2392
说谎
说谎 2020-11-21 05:06

How do I send a cross-domain POST request via JavaScript?

Notes - it shouldn\'t refresh the page, and I need to grab and parse the response afterwards.

17条回答
  •  被撕碎了的回忆
    2020-11-21 06:00

    This is an old question, but some new technology might help someone out.

    If you have administrative access to the other server then you can use the opensource Forge project to accomplish your cross-domain POST. Forge provides a cross-domain JavaScript XmlHttpRequest wrapper that takes advantage of Flash's raw socket API. The POST can even be done over TLS.

    The reason you need administrative access to the server you are POSTing to is because you must provide a cross-domain policy that permits access from your domain.

    http://github.com/digitalbazaar/forge

提交回复
热议问题