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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...