How can I access a backing Bean property from a callback JavaScript function which is executed after an AJAX request has been successfully completed?
My .xhtml code is the following:
<h:commandLink value="Link" >
<f:ajax event="action" listener="#{user.onClickLink}" onevent="onEventLink"/>
</h:commandLink>
My .js function code is the following:
function onEventLink(data){
switch (data.status) {
...
case "success":
// here i need to get a backing Bean property
break;
}
}
I know I can pass the backing Bean property to the JS function by using an EL doing something like this:
onevent='onEventLink(#{user.getProperty()})'
but doing that I loose the reference to the data object JSF passes to the function related to 'onevent' property.
I'd really appreciate if someone could tell me the rigth way to acomplish such sort of task. Thanks.