pass function in json and execute

Yes, you can. There are tons of ways to do it.

And there is no need to use the “evil” eval function (please yahoogle why it should be avoided) as pointed out here: http://javascript.about.com/library/bleval.htm

var tmpFunc = new Function(codeToRun);
tmpFunc(); 

Whether it was JSON at any stage should be irrelevant.

Leave a Comment

tech