我希望知道以下两者是否有性能上的差异(或者根本就没有区别):
1.
``` 代码示例1 ```
2.
``` 代码示例2 ```
1.
``` 代码示例1 ```
2.
``` 代码示例2 ```
$(selector).load('page #myid');
并且
$.get('page',function(data){
$(selector).html( $(data).find('#myid') );
/* depending the dom tree it should be .filter() */
})
get()
相对于load()
提供了额外的功能。然而,上面的简单示例并没有表明它们是必需的,所以load()
应该完全可以胜任。此外,如果需要从文档中获取多个部分,则使用单个带有回调函数中的find()
的get()
比多个单独的load()
请求更好。 - Nope