Passing jquery function from php

I have a problem. I am trying to create highchart from php. Everything was fine, but I can’t do one thing. I need to paste this code

 event => Array (                                          
    load => requestData (),
    )

The problem is that php interprets the code as a function, and if I put

load => 'requestData ()', 

highcharts does not interpret this function. What can I do?

+4
source share
2 answers

Just pass it without parentheses:

load => 'requestData', 

This is the standard way of referencing a function in Javascript: functionName()calls the function and evaluates its return value; functionNameevaluates the function itself.

+5
source

Ude in php:

load => 'requestData ()', 

and in javascript:

eval(load);
0
source

All Articles