javascript - The value of a variable for creating dynamic content -
i not sure if it's possible. looking function dynamically evaluates value of variable , pastes in place of variable itself.
scenario:
resources: resourcessource,
i have above line in 1 of plugins declaration. variable resourcessource contains required json string. want this:
resources: evaluate(resourcessource),
after javascript should take as:
resources: [{'name': 'adil malik','id': '217_resid'},{'name': 'adam jones','id': '433_resid'},{'name': 'help team','id': '2056_resid'},]
instead of putting variable there this:
resources: resourcessource,
you can use built in jquery $.parsejson()
function that. although if resourcessource
json object, there no need accessible through resources
.
resources: $.parsejson(resourcessource), ...
reference - http://api.jquery.com/jquery.parsejson/
description:
takes well-formed json string , returns resulting javascript object.
Comments
Post a Comment