Is there a way to find out if a function in a namespace exists? I'm trying to get the attribute value of an HTML element and then checking if the string value has a corresponding JavaScript function.
<a id="myLink" href="http://stackoverflow.com/" data-success-callback="$.Namespace.SomeFunction" />
var successCallback = $('#myLink').data('success-callback');
I know I can use typeof window[callback] === 'function' to check for functions declared globally but this doesn't seem to work with functions in a namespace; it's undefined.
Is there a way to handle this?
Thank you :)
I used this instead:
Got it here: Access namespaced javascript object by string name without using eval