ldsmike88 Posted March 17, 2007 Share Posted March 17, 2007 I have a variable that contains some functions I want executed. For example: var mystring = "myFunction('hello');mySecondFunction('me', 'again');"; I tried using eval(mystring) but that didn't work. How would I go about executing those functions? Thanks! Link to comment https://forums.phpfreaks.com/topic/43093-solved-execute-functions-in-a-variable/ Share on other sites More sharing options...
emehrkay Posted March 17, 2007 Share Posted March 17, 2007 eval should work x = 'alert("dasfdf");'; eval(x); would alert Link to comment https://forums.phpfreaks.com/topic/43093-solved-execute-functions-in-a-variable/#findComment-209569 Share on other sites More sharing options...
ldsmike88 Posted March 17, 2007 Author Share Posted March 17, 2007 But it doesn't work. I get an "Object Expected" error. This is what I have: executeFunctions("update('EFY', 'Jul 09 2007 11:00:00');"); function executeFunctions(functions){ eval(functions); } Link to comment https://forums.phpfreaks.com/topic/43093-solved-execute-functions-in-a-variable/#findComment-209576 Share on other sites More sharing options...
ldsmike88 Posted March 18, 2007 Author Share Posted March 18, 2007 Answered in the AJAX forum: http://www.phpfreaks.com/forums/index.php?topic=131773.new;topicseen#new Link to comment https://forums.phpfreaks.com/topic/43093-solved-execute-functions-in-a-variable/#findComment-209672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.