Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuAjax error

Locked
nekpap
Posts: 27
Joined: Wed Dec 03, 2014 7:41 am

nuAjax error

Unread post by nekpap »

Hi,

is there any way to get a notification when nuAjax fails due to an error (for example a connection error)?

Thanks
Nektarios
david
Posts: 4
Joined: Mon Jun 15, 2009 10:01 am

Re: nuAjax error

Unread post by david »

nekpap,

If you are using the latest version of nuBuilder, you can pass a fail function to nuAjax();

Example:

Code: Select all

nuAjax(
    'PROCEDURE_CODE',
    {
        async:true,
        data:{
            data_to_send_to_procedure: 'test'
        },
        done: function(){
            alert('Done.');
        }, 
        fail: function(){
            alert('Failed, connection error.');
        },
        always: function(){
            alert('Finished ajax call.');
        }
    }
);
nekpap
Posts: 27
Joined: Wed Dec 03, 2014 7:41 am

Re: nuAjax error

Unread post by nekpap »

Thanks David! I will try it!
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuAjax error

Unread post by admin »

.
Locked