Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to initiate single javascript call asynchronously?  RSS feed

Bronto Brontkevich
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I develop web application using icefaces. I need to play sound on some event token place on server. I can play sound with special javascript function when user generated some event (clicked the button). I use this code:

But here I have no any user event. I must call java script asynchronously. In this case usually FacesContext.getCurrentInstance() just returns null and my call fails. Thats fun. I'm using AJAX (asynchronous javascript) toolkit but I can not initiate asynchronous javascript call!
Of course I tryed to write in my main template.jsp something like that:

When event on server happens - I write my javascript in my backing beans field. But how to remove this script after first execution on user side from my backing bean? Otherwise it will be executed several times. And I realise that this solve is ineffective...
Any ideas?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!