jQuery:加载方法-重新加载页面的特定部分而没有url? [英] jQuery: load method - reload a specific part of a page without url?

查看:167
本文介绍了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');

这篇关于jQuery:加载方法-重新加载页面的特定部分而没有url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆