Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #7944
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Alessandro Pellizzari <shuriken@amiran.it> |
| Newsgroups | it.comp.lang.javascript |
| Subject | Re: Gestione eventi ajax (ajaxStop, ajaxError etc...) non sempre funzionante. |
| Date | 16 Dec 2015 20:19:40 GMT |
| Lines | 30 |
| Message-ID | <dddvasFinb3U1@mid.individual.net> (permalink) |
| References | <n4r8k7$ob0$1@speranza.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net QwQ7QKbsWOQpmRCga1W/pAFOkg4S1BS+k/XGHcSgZd0HyMIIg= |
| Cancel-Lock | sha1:k/v6FCOOhNu9rQfoGlDa39f5iaE= |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| Xref | csiph.com it.comp.lang.javascript:7944 |
Show key headers only | View raw
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 | Next 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