# PDL_CallJS

## Description

In a combined JS/Plug-in app, this API allows the Plug-in component to call a JavaScript function. The call is made asynchronously and nothing is returned.

## Syntax

>     PDL_Err PDL_CallJS(const char *functionName, const char **params, int numParams);

Argument | Description
--- | ---
function | Pointer to JS function to call.
params | Pointer to array of parameters to pass.
numParams | Number of parameters being passed.

## Example

>     const char *params[2];
>     params[0] = "foo";
>     params[1] = "bar";
>     PDL_Err mjErr = PDL_CallJS("testFunc", params, 2);
>     if ( mjErr != PDL_NOERROR )
>     {
>       printf("error: %s\n", PDL_GetError()); <br />
>     }

>     //**
>     //** This is the JavaScript side.
>     //**
>     //** In the setup function of the assistant class
>     //** 'Plugin1' = Object for Plug-in App
>     //**
>     $('Plugin1').testFunc = this.testFunc.bind(this);

>     //** A member function of the assistant class
>     testFunc: function(a, b)
>     {
>       $('outputId').innerHTML = String(a) + "-" + String(b);
>     };

See also:

- PDL_RegisterJSHandler
- PDL_JSRegistrationComplete
- PDL_GetNumJSParams
- PDL_GetJSParamString
- PDL_GetJSParamDouble
- PDL_GetJSParamInt
- PDL_JSException
- PDL_JSReply