0

For example, when making a payment with credit-card we POST to url /paymybill-cc. And we want to avoid reposting when the user refresh the page. In this case, is it a preferred way to redirect to the same url with GET method?

Devs love ZenUML
  • 11,344
  • 8
  • 53
  • 67

1 Answers1

1

Usually the POST happens to a url specifying what you want to create, like in your case, but the GET should happen to a url like /paymybill-cc/:id to get a specific one.

If I were allowed to GET /paymybill-cc I would expect it to return all payments, maybe with a default limit, but a lot of them.

If the user reloads the page that contains POST data then he will be prompted about resubmitting his data to the server. See How do I reload a page without a POSTDATA warning in Javascript? for a bit more details on that.

Community
  • 1
  • 1
Alberto Zaccagni
  • 30,779
  • 11
  • 72
  • 106