Send POST data to PHP without using an HTML form?

前端 未结 7 2000
眼角桃花
眼角桃花 2020-12-08 11:54

Is there anyway to send post data to a php script other than having a form? (Not using GET of course).

I want javascript to reload the page after X seconds and post

7条回答
  •  [愿得一人]
    2020-12-08 12:28

    You can send an xhr request with the data you want to post before reloading the page.

    And reload the page only if the xhr request is finished.

    So basically you would want to do a synchronous request.

提交回复
热议问题