引导popover:重新加载的内容与阿贾克斯 [英] bootstrap popover: reload content with ajax

查看:194
本文介绍了引导popover:重新加载的内容与阿贾克斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个引导popover与阿贾克斯的麻烦重装内容。 下面是一些code: http://pastie.org/3960102

I'm having trouble reloading content of a bootstrap popover with ajax. Here's some code: http://pastie.org/3960102

第二个Ajax请求(当我点击a。关闭)返回一个更新的内容(我可以看到它在控制台),但它不是popover里面加载。

The second ajax request (when I click on "a.close") returns an updated content (I can see it in the console), but it is not loaded inside the popover.

我看了看周围的解决方案,他们都不上班。

I looked around for solutions, none of them seem to work.

还有什么我可以试试吗? 谢谢

What else can I try? Thank you

推荐答案

为什么空()然后追加()时,你可以更换?

Why empty() and then append() when you can just replace?

t.data('popover').tip().find('.popover-content').html(r);

编辑:

另外,第一种方法是正确的,工作正常(引导2.1)时,popover已初始化并且要动态更改的内容。你只需要再次呼吁popover刷新(内容和位置):

Also, the first approach is correct and works fine (bootstrap 2.1) when popover is already initialized and you want to change the contents on the fly. You just have to call 'show' again for the popover to refresh (content and position):

t.attr('data-content', r);
t.popover('show');

这篇关于引导popover:重新加载的内容与阿贾克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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