Seite 1 von 1

JS: "use strict" und jQuery(document).ajaxSend()

Verfasst: Dienstag 20. März 2012, 16:13
von jens
Hab gemerkt das der JavaScript code von https://docs.djangoproject.com/en/dev/r ... csrf/#ajax nicht funktioniert, wenn man "use strict" setzt.

Dabei ist es wohl so, das die Funktion durch .ajaxSend() überhaupt nicht aufgerufen wird. Bsp:

Code: Alles auswählen

jQuery(document).ajaxSend(function(event, xhr, settings) {
    log("ajaxSend...");
});
Offene bugs in jQuery sind nicht gemeldet: http://bugs.jquery.com/search?q=%22use+ ... &ticket=on

Weiß jemand woran es liegen könnte?
"use strict" einfach nicht setzten?

Re: JS: "use strict" und jQuery(document).ajaxSend()

Verfasst: Samstag 24. März 2012, 13:31
von sma
Die Dokumentation sagt:
The global option prevents handlers registered using .ajaxSend(), .ajaxError(), and similar methods from firing when this request would trigger them. This can be useful to, for example, suppress a loading indicator that was implemented with .ajaxSend() if the requests are frequent and brief. With cross-domain script and JSONP requests, the global option is automatically set to false. See the descriptions of these methods below for more details. See the descriptions of these methods below for more details.
Könnte es daran liegen?

Stefan

Re: JS: "use strict" und jQuery(document).ajaxSend()

Verfasst: Montag 26. März 2012, 08:45
von jens
Gute Frage... Vielleicht sollte man es eh besser so machen, das man Explizit eine Funktion nutzt, die "X-CSRFToken" einfügt.