Get Started!

Canvas API

This area contains the details about Canvas API

ToDo

PageBase ControlBase getParam App.DB.DataTypes

FindAll

Slug

n4:listing n4:selection

Get Params

Common method for reading values from query string / URLs or Posted values.

Getting a string

Here's how to get a string parameter name from the request :

// Declare a string variable
var name = ""; 

// Read the value from the request
getParam("name", out name);

// Use name
...

The var name will contain a value from the request regardless of the method to which is was sent to the server.

From the Query String

For example a URL Query String:

/index.html?name=NetCanvas

The value of the name variable would be : NetCanvas

From URL Slug

If there was a section with a slug of :

/products/{name}.html

And The request for the URL was :

/products/net-canvas.html    

The value of the name variable would be : net-canvas

From URL POSTed Form

If the Page was POSTed back to the server from a form with an element :

<input type="hidden"
       name="name" 
       value="NetCanvas"/>

The value of the name variable would be : NetCanvas

jQuery $.post

If you were to use jQuery to POST to the server :

$.post( "index.html", { name: "NetCanvas" } );

The value of the name variable would be : NetCanvas

Other Params Types

There are another couple of methods for other types, all of which support the different requests methods :

  • getIntParam

    Converts the value to an int

  • getLongParam

    Converts the value to an long