I have a jQuery ajax call that looks something like this:
jQuery( document ).on( 'mouseover', '#wp-admin-bar-noti-bar-new', function() {
jQuery.ajax({
url: "domain.com",
// etc
success:function(data){
// change element id
jQuery('#wp-admin-bar-noti-bar-new').attr('id','wp-admin-bar-noti-bar');
}
});
});
So if ajax call is successful, it changes element. My question is, how do I make it so that if call is unsuccessful after 10 seconds, it should cancel it and do something (like show alert).
How can I do this?