dynamic function calls on ajax success

dynamic function calls on ajax success

I am trying to call a dynamically chosen function on success from an ajax call (later to be error and so on also)

The following function works fine and passes the url to call and parameters into the makeAjaxPostCall function. successHandler is the function to call on ajax success.
  1. function handleListAction(action, parentID) {
  2.    
  3.     var url, parameters, successHandler;
  4.    
  5.     switch (action) {
  6.         case 'unsubscribe':
  7.             url = "/profile/unsubscribeall/?ajax=TRUE";
  8.             successHandler = "testFunc";
  9.             break;
  10.         case 'unfollow':
  11.             url = "/profile/unfollowall/?ajax=TRUE";
  12.             break;
  13.         default:
  14.             return false;
  15.     }
  16.    
  17.     var checkedItems = [];
  18.     $("#" + parentID + " input[@name='delbox']:checked").each(function() {checkedItems.push($(this).val());});
  19.     parameters = "items=" + checkedItems.join('|');
  20.    
  21.     makeAjaxPostcall(url, parameters, successHandler, false);
  22.     return 0;
  23. }
The following is the function that makes the call.
  1. function makeAjaxPostcall(url, parameters, successHandler, validation) {
  2.     
  3.     if (objReq) {
  4.         objReq.req.abort();
  5.     }
  6.    
  7.     if (validation) {
  8.         $("#validation").fadeOut(250);
  9.     }
  10.    
  11.     $.ajax({
  12.         type: "post",url: url, data: parameters,
  13.         success: What do I do in here?
  14.     }); //close $.ajax(
  15.    
  16. }