Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #7945
| From | GriS <GriS@nospam.no> |
|---|---|
| Newsgroups | it.comp.lang.javascript |
| Subject | Re: Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante. |
| Date | 2015-12-17 12:02 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <n4u4od$56f$1@speranza.aioe.org> (permalink) |
| References | <n4r8k7$ob0$1@speranza.aioe.org> <dddvasFinb3U1@mid.individual.net> |
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 | Next — Previous in thread | Find similar
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