I have many places in my code doing "$.ajax" call can I define one place to handle all errors ?
I know there is "error: function ... " that I can place in each call , but I want to write it just one time
$.ajaxSetup({});
You should not use the $.ajaxSetup() event handler method (as stated by the JQuery docs):
http://api.jquery.com/jQuery.ajaxSetup/
Note: Global callback functions should be set with their respective global Ajax event handler methods—.ajaxStart(), .ajaxStop(), .ajaxComplete(), .ajaxError(), .ajaxSuccess(), .ajaxSend()—rather than within the options object for $.ajaxSetup().
Use the $.ajaxError() method instead: