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.
精彩评论