I'm using a plugin that has a settings object like this:-
var settings = {
'onValidate' : myValidationCallback
}
const myValidationCallback= (params) => {
// return true if ajax is success
// return false if ajax is failed
}
I'm using $.ajax
I understand that $.ajax
is an async call. How do i properly use callback here to return true/false?
Here's what i did so far but hit the async code blo
const myValidationCallback= (params) => {
$.post( "/sample", { name: "John", time: "2pm"})
.done(function() {
return true;
})
.fail(function() {
return false;
});
}