Return to Product Support > Learning Center > Developer References > Javascript API > cj.remote

cj.remote

The remote method uses ajax to execute server addon methods.

cj.remote(arguments)

Example

cj.remote({

'method':'myRemoteMethodAddon'
,'formId':'myFormId'
<pre style="line-height: 19.2px;">,'callback':myCallbackFunction</pre><pre style="line-height: 19.2px;">,'callbackArg':jsObjectPassedAsSecondCallbackArg</pre><pre style="line-height: 19.2px;">,'destinationId':'IdOfHtmlElementWhereResponseWillBeSet'</pre><pre style="line-height: 19.2px;">,'onEmptyHideId':<span style="line-height: 19.2px; font-family: verdana, sans-serif;">'IdOfHtmlElementToBeHiddenIfResponseIsEmpty'</span></pre><pre style="line-height: 19.2px;">,'onEmptyShowId':<span style="line-height: 19.2px; font-family: verdana, sans-serif;">'IdOfHtmlElementToBeShownIfResponseIsEmpty'</span></pre><pre style="line-height: 19.2px;">,<span style="line-height: 19.2px; font-family: verdana, sans-serif;">'queryString':'a=1&b=2'</span></pre><pre style="line-height: 19.2px;">,<span style="font-family: verdana, sans-serif; line-height: 19.2px;">'url':'/optionalLinkIfNoRemoteProvided'</span></pre>
});

Arguments

'method': string - addonname

'formId': string - html Id of form to be submitted

'callback': function - function to call on completion, two arguments, response and callbackArg

'callbackArg': object - passed direction to the callback function

'destinationId': string - html Id of an element to set innerHtml

'onEmptyHideId': string - if return is empty, hide this element

'onEmptyShowId': string - if return is empty, show this element

'queryString': string - queryString formatted name=value pairs added to post

'url': string - link to hit if not addon name provided

.