I have jsf code which after javascript click calls hidden button click function, that performs ajax request and refresh the page. But I want call another javascript function when ajax returns new values. Here is my code
<h:panelGrid styleClass="float-left" columns="2">
<h:outputText value="Хранилище ключей: " />
<h:panelGroup>
<p:inputText value="#{SessionBean.getCurrentLocaleName(SessionBean.userProfileController.keySettingsForm.storage)}" onclick="$('#selectStorageB').click();" onchange="" readonly="true" style="cursor: text; width: 275px;" />
<p:commandButton id="selectStorageB" style="display: none;"
actionListener="#{SessionBean.storageController.selectStorageForm.openSelectStorageDialog}">
<p:ajax event="dialogReturn" update=":indexForm" process=":indexForm" immediate="true"
listener="#{SessionBean.userProfileController.keySettingsForm.onStorageChosen}" oncomplete="chooseStoragePath(#{SessionBean.userProfileController.keySettingsForm.storage.alias})" />
</p:commandButton>
<p:commandButton icon="ui-icon-cancel" immediate="true" style="width: 18px; white-space: pre-wrap; margin-left: 5px"
actionListener="#{SessionBean.userProfileController.keySettingsForm.resetSigningStorageName()}" update=":indexForm">
</p:commandButton>
</h:panelGroup>
</h:panelGrid>
My problem is javascript function does not see new values.