Call javascript function when category was added via ajax

Recently, I just have the same problem and got the solution.

  1. use ajaxSuccess event since we need to reset input when ajax is completed.
  2. filter the settings data for specific action and screen.

Code:

$(document).ajaxSuccess(function(e, request, settings){
        var object = $.deparam(settings.data);
        if(object.action === 'add-tag' && object.screen === 'edit-category' && object.taxonomy === 'category'){
            //DO RESET Your Input Here
        }
    });

I’ve use the jquery-deparam plugin to parse the settings.data string.