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

Invoking server-side functions from the client

In the previous recipe, we learned how to create JavaScript functions/code on the server and how to invoke/trigger those codes from the client. This is very useful, however, it's not enough, since there are times when we need to do the opposite. In other words, what do we do when we need to call a function on the server side using JavaScript? The solution is to use Ajax. In this recipe, we'll learn how to use Ajax and Lift's JavaScript abstraction layer to create a function on the server side and call it from the client side.

Getting ready

First of all, we will edit the index.html file.

  1. Invoke the snippet that will create the Ajax function that we are going to call, using the following code snippet: ...

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