The context of this question is as follows: I've written a jQuery plugin using jQuery's recommended design pattern where you pass a string as the first parameter of you plugin to call a desired (and pre-defined) method of that is an object of your plugin method. Such as:
$("selector").php('method_name');
With my particular plugin however (which just calls PHP functions through a simple AJAX handler), I would like to provide its users with the ability to call a given backend PHP function in this manner:
$("selector").php.strlen(param); // As an example of calling the PHP strlen function
Where .strlen isn't a defined method of the .php object (or any other object). In other words is there a way to prevent JavaScript from throwing an exception and catch the name of the desired method name a user is attempting to call, when that method in fact has not been defined and does not exist?
I don't want to go about defining the method names (or interfaces) to every PHP function for obvious reasons. It would be a lot of code overhead and would be very time consuming.