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

后端 未结 17 2389
说谎
说谎 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:08

    High level.... You need to have a cname setup on your server so that other-serve.your-server.com points to other-server.com.

    Your page dynamically creates an invisible iframe, which acts as your transport to other-server.com. You then have to communicate via JS from your page to the other-server.com and have call backs that return the data back to your page.

    Possible but requires coordination from your-server.com and other-server.com

提交回复
热议问题