GET vs POST in AJAX?

前端 未结 9 1426
北海茫月
北海茫月 2020-12-01 03:39

Why are there GET and POST requests in AJAX as it does not affect page URL anyway? What difference does it make by passing sensitive data over GET in AJAX as the data is not

9条回答
  •  日久生厌
    2020-12-01 04:22

    Two primary reasons for having them:

    1. GET requests have some pretty restrictive limitations on size; POST are typically capable of containing much more information.

    2. The backend may be expecting GET or POST, depending on how it's designed. We need the flexibility of doing a GET if the backend expects one, or a POST if that's what it's expecting.

提交回复
热议问题