0

I have a input hidden type which specifies the function that needs to be called. How can I do it using Javascript/Jquery

<input type="hidden" name="extrafunction" id="extrafunction" value="edit_data_provider/DataProviderChange1" />

and in Javascript file

        var fullfunctionName = $('#extrafunction').val();
        var control_name    = fullfunctionName.split('/')[0];
        var function_name   = fullfunctionName.split('/')[1];
        if(control_name == client_control_name)
        {
            //The function call which is in function_name var should come here

        }
Garima Jain
  • 11
  • 1
  • 2

1 Answers1

0

You can use :

window[functionName](arguments);

Hope this helps.


var functionName="my_function";
function my_function(){
   console.log('test from my_function');
}
window[functionName]();
Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101