Reuse jquery

20 views
Skip to first unread message

guettli

unread,
Jun 2, 2015, 4:22:01 AM6/2/15
to django...@googlegroups.com
I guess I am missing something.

Is there no way to load jquery only once per page?

Use case: I have two widgets which need jquery. I want to use
these widgets inside the admin interface and on custom pages.

The admin interface has its own jquery and in jquery.init.js this gets done:

var django = django || {};
django.jQuery = jQuery.noConflict(true);

Since jQuery gets removed from the namespace. This means I can't use
it in the js-files of my widgets.

I really would like to load jquery only once per page.

Regards,
  Thomas Güttler





Bill Freeman

unread,
Jun 2, 2015, 11:24:56 AM6/2/15
to django-users
Are you saying that you can't access it as django.jQuery ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4183890d-7279-4c75-bfe1-de30084b15ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

guettli

unread,
Jun 2, 2015, 11:40:33 AM6/2/15
to django...@googlegroups.com
Hi,

we had a very strange problem with the ordering of the JS files.

the jquery.init.js from django removed the jquery from us which had jquery-ui loaded.

The problem is solved.

  Thomas Güttler
Reply all
Reply to author
Forward
0 new messages