It would be dependant on the 'success or error methods that get called upon return of an API call. So something like this:
ajax({
method: 'POST',
url: "/dostuff",
data: postObject,
success: function(response){
// Do nothing - post has been successfully accepted.
},
error: function(response){
// Uh oh
node.textContent = "Try again, the post didnt submit";
}
});