This is the login panel

Return to Contensive io Home > Documentation > Developer Examples

Create a simple html page with an ajax JSON data request

In this example we create an html static page that calls an ajax method to populate a target caption on the page. It is assumed you understand basic html, css and javascript components.

To install the completed project, download the samples GitHub repository. Log in to the /admin page of your website and open the addon manager. Click on upload and browse to the repository's collection folder,  "/Collections/Demo Json Remote Method". Zip the folder to a single zip file and upload it.

Create a simple html page with ajax data request

The complete source is available at https://github.com/contensive/samples. The page creates a target div and two buttons. One button calls the ajax remote and updates the target div with the response data. The other button resets the target.

Create a Visual Studio Solution that responses to the ajax data request

Create a new visual studio Class Library solution.

Right click on the solution node in the solution explorer and open Manage NuGet Packages for Solutions. add the package "Contensive.CPBase"

Create a new class file and add a namespace

In the namespace, create a new class that inherits AddonBaseClass

Add the required method Public Overrides Object Execute( CPBaseClass cp)

Do your work in this Execute method. The return argument is passed to the calling method.

{"errors":[],"data":{"name":"Bob","id":5}}

space