jquery - Convert string (was a function) back to function in Javascript -


i have function below string. how convert function? pulling event handlers jquery events , want store them string convert them because saved in mysql

function () {      if (!gactiveclick) {         return;     }     saveproduct(); } 

var func = new function(thefunctionstring); func(); 

mdn:

new function ([arg1[, arg2[, ... argn]],] functionbody)

parameters

arg1, arg2, ... argn
names used function formal argument names. each must string corresponds valid javascript identifier or list of such strings separated comma; example "x", "thevalue", or "a,b".

functionbody
string containing javascript statements comprising function definition.


update:

all very bad practice!
should have generic function parameters build want. thing change parameters. store parameters in db have.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -