How to call any javascript function user server connector?

Is there a way to trigger arbitrary javascript function using server side php connector?
I would like to do things like:

  • display a nice error message when there is some server side exception.
  • change some styling/content of application based on grid data values.