T
T
Tatarin2015-02-24 04:36:26
Yii
Tatarin, 2015-02-24 04:36:26

How to convert to json CJavaScriptExpression in yii?

There is an object:

$obj = array(
'load' => new CJavaScriptExpression('function() {}'),
);

when executing it for the client
echo CJSON::encode($obj );
, a line appears on
"code":"function() {}"
how to make this object be converted into a function and not into a pair of code : line for eval

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tatarin, 2015-02-24
@tatarin

everything, I understand, the question is removed))
it is necessary to replace it with
echo CJavaScript::encode($obj );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question