I have a method which I called like
if(validate()){
//save
}else{
//show error
}
validate method calls a series of methods and all were synchronous calls, now a requirement has come where we also want to make ajax calls and perform some validations.
validate method is called in lots of pages, I want to limit the number of changes.
Basically I need suggestion how can I limit the change, I can put up a new design all together, I used jQuery deferred/promise which led to
var validPromise = validate();
validPromise.done(function(valid){
...........
});
But this would require change to be applied on every page.
validate() method is added using jQuery as follows
$.fn.validate()
Thanks in advance, looking for tips, suggestions if some damage control can be done, I am out of ideas with my limited JS knowledge.