Client script + UI Script + Script Include (Ajax) + Script Include (API)
Client script is a calling side. Optionally, it may be wrapped into a UI Script to form re-usable Client side API.
Script Include (Ajax) is an interface for client side interactions it fetches parameters, validate them and call necessary APIs.
Script Include (API) implements server side functionalities that may and most probably will be used by both Client and Server side logic. No Ajax parameters are available in context, they are supplied as method arguments.