Callback Javascript function through Json return from PHP Callback Javascript function through Json return from PHP json json

Callback Javascript function through Json return from PHP


You can call all global functions like this window["functionName"](arguments);So you have to pass 2 arguments from php

{  "callback" => 'myFunction',   "args" => [     1, 2, 3  ],}

And in js you can run

window[data.callback](...data.args)