Plugin Environment Function callScriptBeforeAJAXReload()

public final function callScriptBeforeAJAXReload(
$className, $scriptName [, $arg1 [, $arg2 [, ... ]]]


This is an alternate version of callScript(), that allows you to run a script before your Plugin is placed in a slot or reloaded via AJAX.

Where You Can Use It

Can be used in your plugin's init() method, from Zenario 7.0.0 onwards.

From version 7.3 onwards you can now use it in your showSlot() method as well.


This only has an effect if your Plugin is reloading via AJAX. It ensures that your script will be called before the contents of your Plugin are replaced.

If you call this on a normal page load rather than an AJAX reload, the behaviour will be the same as if you had called the callScript initialization function; i.e. the script will not run until after your Plugin has been displayed on the page.



The class name of the Plugin that owns the script that you wish to call.

Note that this parameter was introduced in version 5.2.7 of the CMS. To ensure compatibility with earlier code it can be omitted.

If you are writing a Plugin for version 5.2.6 or earlier you must omit this parameter.


The name of a JavaScript function to run.

$arg1, $arg2...

You may pass in extra arguments. Each of these will be recorded and passed to the JavaScript function; i.e. your first extra argument will be passed to the first argument of the function you are calling, your second extra argument will be passed to the second argument of the function you are calling, and so on.

From Zenario 7.0.0 and onwards you may pass arrays as inputs to arguments.


$this->callScriptBeforeAJAXReload('my_plugin_class', 'myFunctionName', 'Hello World');