I have an application based on JSF 2.1 and Primefaces. I need to make an ajax request using Jquery and update the page status. Here the code:
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view>
<h:head>
</h:head>
<h:body>
<h:outputText id="counterViewer" value="#{dataController.outputMessage}"
styleClass="counter-viewer" />
<h:form id="dataForm" >
<h:outputScript>
jQuery(document).ready(function() {
jQuery(document).on("count", function(event, count) {
alert( "Count: " + count );
document.getElementById("#{view.getClientId(facesContext)}:counterViewer").innerText = count;
var hiddenCountValue = document.getElementById("#{view.getClientId(facesContext)}:dataForm:hiddenCountValue");
hiddenCountValue.value = count;
jsf.ajax.request(hiddenCountValue, 'change');
});
});
</h:outputScript>
<h:inputHidden id="hiddenCountValue" value="#{dataController.outputMessage}"/>
</h:form>
</h:body>
</f:view>
</html>
When I use Chrome everything works fine but on firefox 22 the jsf.ajax.request(hiddenCountValue, 'change'); function doesn't work.
Are there other functions that I can use to run my code also on Firefox? Why doesn't jsf.ajax.request(hiddenCountValue, 'change'); work on firefox?
Thanks
Lucaf:view>
When I use Chrome everithyngs work fine but on firefox the
jsf.ajax.request(hiddenCountValue, 'change');
function seems not work.
Are there other functions that I can use to make my code more compatible? Why
jsf.ajax.request(hiddenCountValue, 'change');
not work on firefox?
Thanks
Luca