json - Passing in String to jQuery function as Object -
json - Passing in String to jQuery function as Object -
this might stupid question, i'm trying pass in string of settings i've constructed in next format:
"setting1" : "value", "setting2" : "value", "setting3" : "value" the above saved string named args. nil special, i'm wanting pass in argument function.
$('#element').functionname({ args }); i'm not sure i'm missed here.... thanks!
if have string such this:
'"setting1" : "value", "setting2" : "value", "setting3" : "value"' you can parse using json.parse , object out of so:
var args = json.parse( "{" + str + "}" ); $('#element').functionname(o); but in reality want create such object instead of string start, e.g.:
var args = {"setting1" : "value", "setting2" : "value", "setting3" : "value"}; $('#element').functionname(args); jquery json string object arguments
Comments
Post a Comment