figo2476 Posted July 26, 2008 Share Posted July 26, 2008 In php, it is able to do: $method_name = "save"; $object->$method_name; I wonder is there any way I can do a substitution like this in javascript. Link to comment https://forums.phpfreaks.com/topic/116695-call-objects-method-in-javascript/ Share on other sites More sharing options...
corbin Posted July 26, 2008 Share Posted July 26, 2008 Hrmmm no idea if this will work or not, but it's worth a try: var func = "someFunc"; someclass.func(); Also, you could try it without the quotes, and I'm pretty sure that way would work for sure. Link to comment https://forums.phpfreaks.com/topic/116695-call-objects-method-in-javascript/#findComment-600519 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.