Is there any way to add function to JSON object with php?
i have an array in php like this :
$aoData = array(
array('name' => 0, 'value' => "id"),
array('name' => 1, 'value' => "title"),
array('name' => 2, 'value' => "cat"),
array('name' => 3, 'value' => "img"),
array('name' => 4, 'value' => "des"));
and i want add a function like this:
array('name' => 5, 'value' => function(){return "hi"})
and use this function in my jquery.
is there any way for this?
Update
in data table i need to set aoColumnDefs in php.
"aoColumnDefs":
[{
"aTargets": [ img ],
"mData": "thumb_img",
"mRender": function ( data, type, full )
return '<img src="../up/thumb/'+data+'">';
},
{etc}
]
so i need set function as a Json function or another way ...