title: How to pass a callback as a parameter into another function
body: <p>I'm new to ajax and callback functions, please forgive me if i get the concepts all wrong.</p>
  
  <p><b>Problem:</b> Could i send a <strong><em>callbackfunction</em></strong> as a parameter to another function that will execute the callback?</p>
  
  <pre><code>function firstFunction(){
      //some code
  
      //a callback function is written for $.post() to execute
      secondFunction("var1","var2",callbackfunction);
  }
  
  function secondFunction(var1, var2, callbackfunction) {
      params={}
      if (event != null) params = event + '&amp;' + $(form).serialize();
  
      // $.post() will execute the callback function
      $.post(form.action,params, callbackfunction);
  }
  </code></pre>