callback
Type: string
Default: ''
Context: prediction
About this parameter
The name of a globally accessible function that will be called with the result instead of the default rendering. Only pass the name of an already-defined function — never write the function's code directly inside the attribute.
To avoid clashing with other scripts on the page, define your callback as a property on your own namespace object rather than directly on window.
Usage examples
window.rekaiCallbacks = window.rekaiCallbacks || {};
window.rekaiCallbacks.customRenderPredictions = function(data) {
data = JSON.parse(data);
console.log(data);
}; <div class="rek-prediction" data-callback="rekaiCallbacks.customRenderPredictions"></div>Important
data-callbackmust reference a named function, e.g.rekaiCallbacks.customRenderPredictions— not an inline function body such asdata-callback="(data) => { ... }".- The referenced function must be defined and available on
windowbefore the prediction request completes (typically: defined in a<script>tag earlier on the page). - Passing anything other than a simple function name (dots allowed for namespacing) will be rejected and no callback will run.