difference between $.getJSON and $.get

后端 未结 3 672
轮回少年
轮回少年 2020-12-14 07:41

Is there really a difference in these two calls? If you use getJSON, you still have to declare format=json in the url...

And you can do the same in

3条回答
  •  借酒劲吻你
    2020-12-14 08:14

    The differences between $.getJSOn and $.get are in parameters:

    1. $.getJSON accepts plain objects as data while $.get accepts plain objects or string.
    2. $.get has dataType parameter.

    So, using $.get with dataType: JSON would work exactly the same as $.getJSON.

提交回复
热议问题