Alerting

how to use jquery in Djnago

I have a requirement on clicking of the dropdown,a multidropdown search should trigger.This can be done using jquery but i am unable to include jquery plugin into django in my app.Please help me out

Tags (3)

SplunkTrust
SplunkTrust

Copy the second example into a new Django view, see if it works, and when it does you adapt from there.

0 Karma

Am not able to find the solution from below link.can u please tell if any other possible solution is available

0 Karma

SplunkTrust
SplunkTrust

You should have the $ functions available after {% load splunkmvc %} without manually requiring JQuery. Take a look at the second example on http://dev.splunk.com/view/webframework-splunkjsstack/SP-CAAAESW - that uses $('#elementid') without any manual loading of JQuery.

0 Karma

Motivator

Try

require(["splunkjs/ready!","underscore","jquery","myAddon"], function(mvc,_, jQuery,myAddOn) {

Also, I would add this code before including your javascript file in the page
(This assumes your javascript file is in your appname/django/appname/static/appname

What error are you getting?

SplunkTrust
SplunkTrust

Make sure you have the JS Console open (F12 in many browsers).

0 Karma

I am not getting any error but the functions are not working.

0 Karma

0 Karma

SplunkTrust
SplunkTrust

JQuery should be a part of the web framework already.

0 Karma
Don’t Miss Global Splunk
User Groups Week!

Free LIVE events worldwide 2/8-2/12
Connect, learn, and collect rad prizes and swag!