Alerting

how to use jquery in Djnago

lahariveerlapat
Explorer

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)

martin_mueller
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

lahariveerlapat
Explorer

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

0 Karma

martin_mueller
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

aelliott
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?

martin_mueller
SplunkTrust
SplunkTrust

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

0 Karma

lahariveerlapat
Explorer

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

0 Karma

lahariveerlapat
Explorer

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

JQuery should be a part of the web framework already.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...