sharepoint 2010 jquery webservices
i have a tag cloud on my master page. I would like to redirect links of the tags within that tag cloud to another url (script below).
The script runs fine when i test it with the console in firefox but it doesn't work when i put it in the head of my master.
After investigation i have noticed that my script is loaded before a sharepoint webservice /_vti_bin/SocialDataService.asmx/GetAllTagTerms
which could be the reason!
My question is: would it be possible to use jquery to call that webservice and make it work?
$(document).ready(function () {
var $sel = $("#tagscloud a[href*='tagprofile.aspx?termid=']");
var rootUrl = $('#ctl00_RootUrlId').val();
$sel.each(function () {
var $this = $(this), href = $this.attr('href');
$this.attr('href', rootUrl + 'Recherche/Pages/Results.aspx?k=SocialTagId%3A%22' + href.slice(href.indexOf('tagprofile.aspx?termid='开发者_高级运维) + 23) + '%22');
});
});
Unfortunately the method TagCloudItemsRender
in SocialData.js does not have any events you can hook into.
What you could do, is wait for the tagCloudData
element to be created
var timer = setInterval(function() {
var cloud = $("#tagCloudData"); //need better selector if multiple tag clouds on same page
if(cloud) {
clearInterval(timer);
//do your code here
}
}, 1000)
精彩评论