score:2

Accepted answer

executing javascript from a remote source is a bad idea as you can't trust it. however, if you must:

the function included in the json is a string therefore you need to evaluate it:

 pie.datalabels.formatter = eval('('+pie.datalabels.formatter+')');

for each method of the object that needs to be converted.

however, as said at the start, there is almost certainly a solution that does not require you to fetch javascript in this way.

score:0

i've decided to only return series data for the pie highchart ... instead of the whole highchart configuration array ... plotoptions are now defined in javascript and not returned by a json_encoded php array ..

i'm not too sure why i was doing that but thanks for all the help with eval!


Related Query

More Query from same tag