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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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