Client and server slicing
Opa allows developers to write the server and client code both in the same language within the same module. And even better, the Opa slicer automates the calls between the client and the server. No more manually written Ajax calls or value serialization is needed!
A simple example
Let's get started with a simple example. Suppose we want to send our name to the server and request the server to respond with the words "Say hello to [name] from server":
This is quite simple and can be accomplished with almost any language that we are familiar with. Typically, you would send an Ajax request to the server with name as request data, and the server will respond with a JSON object containing the string we want. The following code fragment demonstrates how we can do this using jQuery for the client-side code and ASP as server-side code:
//code fragment on server side: ajax.aspx Response.ContentType = "application/json"; Response.Write("{result: 'Say hello to " + Request["Name...