Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.javascript > #7945

Re: Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante.

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail
From GriS <GriS@nospam.no>
Newsgroups it.comp.lang.javascript
Subject Re: Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante.
Date Thu, 17 Dec 2015 12:02:34 +0100
Organization Aioe.org NNTP Server
Lines 38
Message-ID <n4u4od$56f$1@speranza.aioe.org> (permalink)
References <n4r8k7$ob0$1@speranza.aioe.org> <dddvasFinb3U1@mid.individual.net>
NNTP-Posting-Host 1EYKSE0oo3A8XWyQY7G6kA.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.2; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com it.comp.lang.javascript:7945

Show key headers only | View raw


Grazie per la risposta,
proverò il tuo codice anche se non ho capito, ajaxStop non credo che 
gestisca anche l'error, o sbaglio?

Grazie ancora.

Il 16/12/2015 21.19, Alessandro Pellizzari ha scritto:
> Il Wed, 16 Dec 2015 09:50:13 +0100, GriS ha scritto:
>
>> Al momento, lo spinner è gestito così:
>>
>> $("#spinner").bind("ajaxSend", function() {
>> $(this).show();
>> }).bind("ajaxStop", function() {
>> $(this).hide();
>> }).bind("ajaxError", function() {
>> $(this).hide();
>> });
>
> Non ho mai usato questi eventi, ma stando alla documentazione di jQuery
> vengono lanciati su document, non su elementi del DOM. Probabilmente li
> catturi grazie al bubbling, ma non so cosa sia il this in quel caso.
>
> Io farei così:
>
> $(document)
>    .on('ajaxStart', function() {
>      $('#spinner').show();
>    })
>    .on('ajaxStop', function() {
>      $('#spinner').hide();
>    })
> ;
>
> Dovrebbero bastare questi due, in teoria.
>
> Bye.
>

Back to it.comp.lang.javascript | Previous | NextPrevious in thread | Find similar


Thread

Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante. GriS <GriS@nospam.no> - 2015-12-16 09:50 +0100
  Re: Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante. Alessandro Pellizzari <shuriken@amiran.it> - 2015-12-16 20:19 +0000
    Re: Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante. GriS <GriS@nospam.no> - 2015-12-17 12:02 +0100

csiph-web