This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

daftspunky
daftspunky

You can change the default behavior of an AJAX error from displaying an alert() message, like this:

<script>
$(window).on('ajaxErrorMessage', function(event, message){

    // This can be any custom JavaScript you want
    alert('Something bad happened, mate, here it is: ' + message);

    // This will stop the default alert() message
    event.preventDefault();

})
</script>

Enjoy! :-)

Connor S. Parks
Connor S. Parks

Cheers for this, daftspunk.

development7672
development7672

For data-request-confirm, you can use ajaxConfirmMessage.

maxim.shvets9654
maxim.shvets9654

How can I translate error messages to another language?

AlecSPB
AlecSPB

maxim.shvets9654 said:

How can I translate error messages to another language?

Yes, how we can?

dervisholliburim18837
dervisholliburim18837

@daftspunk, thanks it was helpful

andrepo18380
andrepo18380

Brilliant @daftspunk.

Any preferred JS flash lib to use for the errors instead?

Cheers!

ilanfir18653
ilanfir18653

I like SweetAlert (my implementation here) but really depends on your needs. If you need a toast message try Toastr I didn't have the chance to use it but it looks promising. And there is always the simplest option of showing/hiding a div

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.