After a button is clicked a message is shown after 3 seconds, but when i try to call a function instead of message then it doesn't do anything? what is reason? thanks
<button onclick="myFunction()">Try it</button>
<p:remoteCommand name="remoteCommandName"
actionListener="#{uploadManagedBean.delayTime()}" />
<script>
function myFunction() {
setTimeout(function(){ remoteCommandName()}, 3000); ----> here the problem: when alert("hello") instead of remoteCommandName() it works but when i try to call the remoteCommandName() it doesn't
}
</script>
Hint: if i change the attribute in remoteCommand from actionListner to onStart, then when i load the page the methode uploadManagedBean.delayTime() will directely called without click on a button and without any delay.