AJAX jQuery.load versus jQuery.get

前端 未结 4 814
深忆病人
深忆病人 2020-11-27 20:16

When should the load( url, data, callback ) method be used versus jQuery.get( url, data, callback, type ) when making AJAX calls with jQuery?

4条回答
  •  再見小時候
    2020-11-27 21:00

    First of all those two functions are completely different. The 'load' function works with selectors and loads the result of AJAX call inside the selected group and the callback is to handle the "oncomplete" event of the call; while the $.get function is more general and the callback handles the success response of AJAX call where you are free to define any behavior you want. And you can find all this information just by looking at the documentation and specification of the jQuery framework.

    Here you can find a good documentation.

提交回复
热议问题