I want to call a bean function in onclick between div tag, but as far as I know one cannot simply call nonscript function in this situation. Actually I am putting an facebook like button as:
<div class="fb-like" data-href="#{someBean.getSomeUrl()}" data-send="false"
data-layout="button_count" data-width="100" data-show-faces="false"
onclick="#{someBean.saveLikeCount()}">
</div>
and I need this kind of onclick operation in order to update and save like count to my database (Facebook automatically increases that number but holds it to itself, so I need to get the count and save it to my database when somebody clicked that like button). Is there a way out ?
Thanks in advance
Your
onclickmethod will never be fired due to fact that Facebook Like Button actually will be loaded iniframeplaced in that element, and event will not propagate to your document… And this way you will never know what user did like or unlike.You can however listen to
edge.create/edge.removeevents (of Facebook JS-SDK) to be able to know whenever someone liked/un-liked