can I post json string only (without “name=”) using form?

前端 未结 1 1137
星月不相逢
星月不相逢 2021-01-25 09:54

I am trying to post json data to an URL which I have no control. The API document says only json data is accepted. I am thinking whether I can use html form to make it easier.

相关标签:
1条回答
  • 2021-01-25 10:35

    No. The work to allow JSON formatted data to be directly generated from a form has been discontinued.

    To make the request you will need to use either:

    • XMLHttpRequest to the API (which requires that permission, including support for a preflight, is granted by the API)
    • XMLHttpRequest to a proxy
    • Server side code

    Any of these could use an HTML form to collect the data before using it to generate the request to the third party API.

    0 讨论(0)
提交回复
热议问题