解决方法
对于那些想知道的人来说,stoplion是指这个功能:
Loading Page Fragments(在页面上向下滚动):
The .load() method,unlike $.get(),allows us to specify a portion of the remote document to be inserted. This is achieved with a special Syntax for the url parameter.
If one or more space characters are included in the string,the portion of the string following the first space is assumed to be a jQuery selector that determines the content to be loaded.
由于$ .get()似乎不支持它,我假设$ .ajax也不会。实现这一点的简单方法如下:
$.ajax({ url: 'http://example.com/page.html',data: {},success: function (data) { $("#el").html($(data).find("#selector")); },dataType: 'html' });
这将相当于
$("#el").load('http://example.com/page.html #selector');
但是,请注意,特殊语法(‘#selector’)意味着加载的HTML中存在的脚本将不会被执行。请参阅Script Execution中的.load()文档。