jQuery:加载方法-重新加载页面的特定部分而没有url?
问题描述:
我想知道是否可以在不传递URL的情况下重新加载页面的特定div吗?
i wondered if it's possible to just reload a specific div of a page without passing a url?
$('a.reload').live('click', function(e) {
$sv.load(" #inside")
});
如果我单击重载链接,我只想重载具有当前页面内ID的div. jQuery如何做到这一点?
if I click the reload-link i want just to reload the div with the ID inside on the current page. Is there a trick on how to do so with jquery?
致谢
答
不可能,但是幸运的是,您可以使用window.location.href
传递页面的URL,然后过滤除所需内容之外的所有内容:>
No, it's not possible, but luckily you can pass the URL for the page with window.location.href
and then filter out everything but the thing you want:
$('#inside').load(window.location.href + ' #inside');