I have created an central AJAX function (using JQuery) which will be responsible for handling all the AJAX calls in my project.var ajaxCall = function(_url, _type, _data, _successCallback, _errorCallback, isAsync, _completeCallback){              // Handling _url    if(!_url.trim()) throw new Error('Sucess callback is not defined');    // Handling _type    if(!_type.trim()) throw new Error('TYPE is not defined');    // Handling _successCallback    if(!_successCallback || typeof _successCallback !== function) throw new Error('Success callback is not defined');    // Handling _errorCallback    if(!_errorCallback || typeof _errorCallback !== function) _errorCallback = function() {};    // Handling _completeCallback    if(!_completeCallback || typeof _completeCallback !== function) _completeCallback = function() {};    // AJAX configuration object    var ajaxObj = {        url : _url.trim(),        contentType : application/json,        type : _type.trim(),        data : _data || {},        async: !!isAsync,        success : function(data) {            try {                _successCallback(data);            } catch (exception) {                global.logger.i(TAG, 'Exception! ' + exception);            }        },        error : _errorCallback,        complete: _completeCallback    };    // Capturing AJAX call    return $.ajax(ajaxObj);};Let me know if this is a valid way to centralize the AJAX calls.
Central ajax function in jquery
javascript;jquery;ajax