【发布时间】:2011-11-24 09:38:47
【问题描述】:
我正在使用 SharePoint 2010,其中一个 aspx 页面包含一个记事板 Web 部件,它提供了在给定页面上发表评论的简单功能。
加载页面时,该 Web 部件使用 AJAX 检索 cmets,我无法控制该 AJAX 调用何时完成。
我正在尝试在 Web 部件用于 cmets 的每个表数据标签中插入一个链接或一些文本,即
<td class="socialcomment">Comment 1</td>
<td class="socialcomment">Comment 2</td>
<td class="socialcomment">Comment 3</td>
到
<td class="socialcomment">Comment 1 <a href="#">Report inappropiate</a></td>
<td class="socialcomment">Comment 2 <a href="#">Report inappropiate</a></td>
<td class="socialcomment">Comment 3 <a href="#">Report inappropiate</a></td>
像这样使用 JQuery
$('td.socialcomment').append(' <a href="#">Report inappropiate</a>');
我无法在上述场景中使用 JQuery 的 live() 函数(适用于我拥有的其他场景),但我认为这是因为它是为事件设计的。 我也尝试过 .ajaxComplete(),但我相信它根本没有成功,因为我无法控制 Ajax 调用,或者 SharePoint 执行的 Ajax 调用未向 JQuery 注册。
非常感谢任何帮助或见解。 提前致谢!
【问题讨论】:
标签: jquery ajax sharepoint dom