You can refer to another function (successHandler) or even to a function by name, since all global functions actually become a method of the window object. For this last solution, all you have to do is add a string variable to your public and local pages containing the correct function name.
function successhandler() { $(this).addClass("done"); } function ajaxStart() { alert('hi'); } $.ajax({ url: "test.html", context: document.body, success: successHandler, ajaxStart: window['ajaxStart'] });
source share