You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Horacio Natyural <ho...@gmail.com> on 2012/05/04 12:00:39 UTC

How To Catch Network Disconnection In Ajax Buttons

Hi,

How do we catch network disconnection ?

For example, I'm submitting using an indicatingajaxbutton, when the
network is disconnected, the loading indicator disappears and the
button is available again. Is there anyway that I can catch network
disconnections in indicatingajaxbutton or any ajax button for that
matter.

I would like to post an alert warning to the client that he/she has
been disconnected from the server.

Is there anyway that I could insert something into this method?

this is in wicket-ajax.js

failure: function(message) {
        if (message != null)
            Wicket.Log.error("Wicket.Ajax.Call.failure: Error while
parsing response: " + message);
        this.request.done();
        this.failureHandler();
           Wicket.Ajax.invokePostCallHandlers();
           Wicket.Ajax.invokeFailureHandlers();
    }

Thanks!
Carlo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How To Catch Network Disconnection In Ajax Buttons

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use browser's online and offline events to be notified when
the network is down for some reason. See
http://stackoverflow.com/questions/3181080/how-to-detect-online-offline-event-cross-browser


On Fri, May 4, 2012 at 1:00 PM, Horacio Natyural
<ho...@gmail.com> wrote:
> Hi,
>
> How do we catch network disconnection ?
>
> For example, I'm submitting using an indicatingajaxbutton, when the
> network is disconnected, the loading indicator disappears and the
> button is available again. Is there anyway that I can catch network
> disconnections in indicatingajaxbutton or any ajax button for that
> matter.
>
> I would like to post an alert warning to the client that he/she has
> been disconnected from the server.
>
> Is there anyway that I could insert something into this method?
>
> this is in wicket-ajax.js
>
> failure: function(message) {
>        if (message != null)
>            Wicket.Log.error("Wicket.Ajax.Call.failure: Error while
> parsing response: " + message);
>        this.request.done();
>        this.failureHandler();
>           Wicket.Ajax.invokePostCallHandlers();
>           Wicket.Ajax.invokeFailureHandlers();

You can register 'postCallHandler' and/or 'failureHandler' and this
method will call it/them for you.

>    }
>
> Thanks!
> Carlo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org