Javascript Functions

 
printControlPanel(ob_get_clean()); ?>
Status
Log (Clear)
This page tests the ability to add, remove, wrap and call javascript functions. The status (above) will update every second indicating whether the function (called myFunction) is present in the javascript environment on the browser. Click the add button to have the xajax function "install" the function on the browser. If it already exists, it will be replaced. Click the remove button to have the function removed from the javascript environment.

By clicking the call button, you can have the xajax enabled function invoke the function from the server. The function, if present, will pop up an alert indicating that it was called.

The wrap button will cause the xajax enabled function to generate a function wrapper around the existing javascript function. The wrapper function will pop up an alert message before calling the original function, then another alert message once the function returns. The wrapper function can be added around the original function any number of times. Each time the wrapper function is applied, it will add a new "layer" where the before and after alert messages are displayed. Click the call button after wrapping the function to see the result.