开发者

I got a question, jQuery.load or jQuery.ajax to load data of a database

开发者 https://www.devze.com 2023-03-17 02:29 出处:网络
I wonder which one will perform better. th开发者_运维技巧anks.Well, they aren\'t alternatives...They have different meanings, uses and purposes.

I wonder which one will perform better.

th开发者_运维技巧anks.


Well, they aren't alternatives... They have different meanings, uses and purposes.

$.ajax is the all-purpose jQuery AJAX function. All other AJAX functions use it, including .load. If you want to do anything other than load a resource using AJAX, you have to write the code yourself.

.load uses $.ajax internally to get a resource, then loads that resource into the document, using the selection on which load was called.

If you want to do the latter, use load. If you want to do anything else, use $.ajax or one of the other jQuery AJAX functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消