Plugin Framework Function refreshPluginSlotJS()

public final function refreshPluginSlotJS(
$requests = '', $scrollToTopOfSlot = true, $fadeOutAndIn = true
)

Summary

Generates JavaScript that will cause your Plugin to reload via AJAX.

Where You Can Use It

Can be used in methods called by plugins. From Zenario 7.0.0 onwards.

Description

This function will return the JavaScript code to a call to the refreshPluginSlot() JavaScript function.

While you may wish to write this manually, the inputs needed are the same as the refreshPluginSlotAnchor() utility function. If you're adding links to a Theme then it is recommended that you call both functions and put the results into two different Merge Fields, so that Theme creators have a choice of which they use.

Parameters

$requests

Any GET requests you wish the Plugin to see as it is reloaded. Should be in the format:

request1=value&request2=value

Note that you can't use POST. If you need POST then you should use a form instead; see the openForm utility function for details.

$scrollToTopOfSlot

From version 5.2.2, you can use this parameter to control whether the Visitor's page should scroll back up to the top of the Slot when it is refreshed.

$fadeOutAndIn

From version 6.0, you can use this parameter to control whether or not the Slot should become semi-transparent while the AJAX call is in progress.

Return Value

The JavaScript code needed to reload the Plugin.

Example

$this->mergeFields['JS_Link'] = $this->refreshPluginSlotJS('request=value');
<input type="button" onclick="<!--JS_Link-->" value="<!--_CLICK_ON_THIS_BUTTON-->/>

This example illustrates how to put a link on a theme.