Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AJAX jQuery.load versus jQuery.get

Tags:

jquery

ajax

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

like image 423
jamesaharvey Avatar asked Aug 07 '09 17:08

jamesaharvey


1 Answers

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.

like image 119
Artem Barger Avatar answered Sep 21 '22 22:09

Artem Barger