websAspDefineGoAhead WebServer APIGoAhead EMF

Synopsis

Define an ASP script procedure.

Prototype

 #include "webs.h" 

 int websAspDefine(char_t *name, int (*fn)
     (int ejid, webs_t wp, int argc, char_t **argv)); 

Parameters

nameName of ASP command to define.
fnPointer to function to call when the script name is invoked in an ASP page.

Description

websAspDefine creates an ASP JavaScript procedure that can be called from within an ASP page. The function supplied will be called whenever the name procedure is executed in the ASP page. The name must be unique.

The name procedure is provided a wp handle to the browser connection. This can be used to call many other GoAhead WebServer functions. The argv parameter includes any script arguments provided in the ASP page when calling the name script.

Fn must meet the prototype requirement shown above, i.e., it must accept the four arguments ejid, wp, argc, and argv. ejid is the JavaScript interpreter handle used when calling JavaScript related functions such as ejGetVar or ejSetResult. wp is the WebServer handle to the browser connection used when calling webs related functions such as websDone. arcg and argv contain the count and content of the script arguments to name.

Return Value

Returns 0 if successful; returns -1 on errors.

Example

int outputMyTable(int ejid, webs_t wp, int argc, char_t **argv)
{ 
	websWrite(wp, "Add HTML code to create a table for %s", argv[0]); 
} 

websAspDefine("outputTable", outputMyTable); 

Stability Classification

Stable.

See Also

JavaScript, Active Server Pages