简体   繁体   English

jQuery标签-重新加载/刷新标签选择上的内容,如何?

[英]Jquery Tabs - reload/refresh content on tab select, how?

I've been researching for several hours now and I can't seem to figure this out. 我已经研究了几个小时,但似乎无法弄清楚。 Although I have seen several topics similar to this, I just can't seem to make sense of it — bare in mind I know next to nothing about jquery. 尽管我已经看到了几个与此类似的主题,但我似乎还是没有道理-记住我几乎不了解jquery。

I was able to get running following this tutorial: http://www.jacklmoore.com/notes/jquery-tabs/ 我能够按照以下教程运行: http : //www.jacklmoore.com/notes/jquery-tabs/

It does EXACTLY what I am looking for, BUT I need to be able to reload the tab content or page when I select between the tabs back and forth — of course after the reload I want to still be under the current tab. 它完全符合我的要求,但是当我在来回切换的选项卡之间进行选择时,我需要能够重新加载选项卡的内容或页面-当然,在重新加载之后,我仍希望位于当前选项卡下。

Why? 为什么?

I am using this method as a selector for sorting my comments (newest posted and highest rated). 我使用此方法作为对我的评论(最新发布和最高评分)进行排序的选择器。 Problem is, the process or functions (comment replies) are loaded on the default tab and when I select to the other tab, any links I click there will only show on the original tab. 问题是,过程或功能(评论答复)被加载到默认选项卡上,当我选择另一个选项卡时,我单击那里的任何链接都只会显示在原始选项卡上。

What code can I add to reload content so that clicking on tabs reloads the process? 我可以添加什么代码来重新加载内容,以便单击选项卡重新加载过程?

Thanks! 谢谢!

You can use ajax or dynamic content you generated before. 您可以使用之前生成的ajax或动态内容。

$(".tabs a").on("click", function() {
    var curTabId = $(this).attr("href");
    $(curTabId).load('content.html');
    //or $(curTabId).html(yourGeneratedContent);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM