I customized the item_CommonHoverPanel_Actions display template and added custom link to it. Whenever user clicks on the link he/she is redirected to another page.
What i am trying to do now is to add(log) user info to another list whenever he/she clicks on the link.
Can someone guide me in the right direction about how to do it?
Update: I have added jquery via $includescript and now i am trying to add click event handler to the link but seems that its not working. Here is the code:
<!--#_
var LinkTilSakHtml = "";
var LinkTilSak = "http://google.com";
if(!$isEmptyString(LinkTilSak))
{
LinkTilSakHtml = String.format('<a class="ms-calloutLink ms-uppercase" id="yourTestLink" href="javascript:;" title="Go til sak"> Test link</a></div>');
}
_#-->
<div class="ms-srch-hover-action">
_#= LinkTilSakHtml =#_
</div>
<!--#_
}
if (!Srch.U.isSPFSKU() && ctx.CurrentItem.csr_ShowFollowLink && !$isEmptyString(ctx.CurrentItem.Path)){
var isDoc = true;
if(!$isNull(ctx.CurrentItem.csr_IsSite) && ctx.CurrentItem.csr_IsSite == true){
isDoc = false;
}
}
AddPostRenderCallback(ctx, function() {
$('#yourTestLink').click(function() {
alert ("inside onclick");
});
});
_#-->
I am adding the event handler in AddPostRenderCallBack() method. Can some one help me find out what am i doing wrong?