O'Reilly logo

Lift Application Development Cookbook by Gilberto T. Garcia Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending JavaScript commands from the server

Sometimes there is a need to call a JavaScript function—to update the UI or for some other reason—depending on the result of some business logic that runs in the server.

If you are not using Ajax, the only way to achieve this is by redirecting the user to add a parameter in the URL, so you can check for its existence and decide whether to call the given function or not. For example, let's say that you need to execute a JavaScript function depending on the parameter foo. If you are not using Ajax, you'll have to redirect the user to /somePage?foo=valueOfFoo, and depending on the value of foo, decide whether your application should execute the JavaScript function or not.

Fortunately, Lift gives us a practical ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required