Skip to content Skip to sidebar Skip to footer

How To Return Javascript As Partial Response?

As response to an Ajax-request I want to return Javascript that is executed on the client immediately. I tried it like this but it doesn't work: Copy

Curly quotes are not a valid string delimiter in JS. Use straight quotes.

writer.write("alert('Works!');");

Unrelated to the concrete problem, based on your question history you're using PrimeFaces, or at least familiar with it. In that case, just use RequestContext#execute() instead of this mess.

Post a Comment for "How To Return Javascript As Partial Response?"