jquery $.post() vs $.get()

前端 未结 5 1189
[愿得一人]
[愿得一人] 2021-02-04 14:47

I need to retrieve a simple page and use the data that it returns. Is there any difference between $.post() and $.get() should I be using one over the

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 15:06

    The main difference between them is that with POST you pass a collection of data and with GET you pass data in the URL. If you're passing a lot of data I'd suggest POST. If you're just calling a URL for a response then use get.

    For a full understanding though checkout the jQuery documentation of each.

    GET: http://api.jquery.com/jQuery.get/

    POST: http://api.jquery.com/jQuery.post/

提交回复
热议问题