title: passing function name to execute as parameter
body: <p>I'm using a $.ajax function that serves two purposes and depending on the context, I want to execute different functions on the call-back.</p>
  
  <pre><code>function MyAjaxCall(SomeParameter, CallBackFunctionName) {
  
    $.ajax({
     ...
     success: function (msg) {
  
       var TheData = msg.hasOwnProperty("d") ? msg['d'] : msg;
       // here: "execute the function in parameter CallBackFunctionName 
       // AND pass it the parameter TheData
    }
  }
  </code></pre>
  
  <p>How do I write the line where the name of the function is a parameter and I want to pass it TheData as the parameter.</p>
  
  <p>Note, at the moment, I'm writing it like that:</p>
  
  <pre><code>if (CallBackFunctionName === "SomeFunctionName1") {
     SomeFunctionName1(TheData);
  } else {
     SomeFunctionName2(TheData);
  }
  </code></pre>