
# How to make the client side program get an HTML element from the server and insert it in the page?

A very convenient way to do that is to use RPCs :

<!--wodoc:@ class=shared-->
```ocaml
let%rpc get_mydiv (() : unit) : _ Lwt.t = div [ ... ]
```
<!--wodoc:@ class=client-->
```ocaml
[%client
  ...
  let%lwt mydiv = get_mydiv () in
  Dom.appendChild parent (To_dom.of_element mydiv)
  ...
]
```
Server functions take exactly one parameter.

RPCs are just syntactic sugar for pathless services returning OCaml values.

The type of the function parameter must have been declared with the JSON module of `ppx_deriving` (which needs to be manually installed). This enables server-side data validation.

example:

```ocaml
type t = int * string [@@deriving json]
```